Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CrossPlatformLocation: Consistent foreground service notification display #248

Open
alexsawers opened this issue Sep 18, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@alexsawers
Copy link

The CrossPlatformLocation demo works nicely, but I think some improvements can be made to keep the app behavior consistent across distinct Android versions, most specifically related to the foreground service notification display:

  • Notification should setForegroundServiceBehavior to FOREGROUND_SERVICE_IMMEDIATE so it displays as soon the service starts (Android 12+). I get the rationale behind the 10-second delay introduced in Android 12 but I think a background location service is expected to run for several minutes anyway. Also, such a delay made me think that the foreground service was not being started at all on my first tests 🤦‍♂️.

  • Notification should setOngoing to true so that the user doesn't dismiss it. Since Android 13 the user can dismiss foreground service notifications, but for a sensitive thing like background location tracking I think it should stay permanent, like on older Android versions, and also for ease of access to the app.

  • App should request the runtime POST_NOTIFICATIONS permission (Android 13+). The foreground service still runs without this permission but the notification doesn't shows up as it never asks for this permission.

I also thought about suggesting to call startForeground with the foregroundServiceType parameter (Android 13+), but given it defaults to all service types declared in the manifest I see that's only relevant for apps with multiple such types declared.

@DelphiWorlds DelphiWorlds self-assigned this Sep 18, 2024
@DelphiWorlds DelphiWorlds added the enhancement New feature or request label Sep 18, 2024
@DelphiWorlds
Copy link
Owner

Thanks for the tips! I have a "reboot" of this demo in the works, and will consider your suggestions for it.

@DelphiWorlds
Copy link
Owner

I've pushed the work in progress to the Playground repo. Please have a look and let me know what you think.

@alexsawers
Copy link
Author

Thanks. I will put any feedback on the Playground repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants