-
-
Notifications
You must be signed in to change notification settings - Fork 653
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
Stopping Background Location Service and Unregistering Listeners #1536
Comments
any update?? |
Is there any update? I also want cancel the foreground service when the user logs out and start it again when the user re-logs in. Additionally, the foreground service notification should also close when the service is canceled. Is there any predefined method for this? |
@TimHoogstrate please check this. |
Summary: Proposed Enhancement: Use Case: Background Location Updates: When background location updates are enabled and the app is killed, there is no straightforward way to access the active stream subscription upon reopening the app. Providing access to this active stream would allow for proper management of the service. Suggested Implementation: Introduce a method in the Geolocator class to get the current active stream subscription so it can be handle later from anywhere. |
Dear @mayank-vinove, Is cancelling the position stream not sufficient like in the example app? Kind regards, |
If the user starts location updates and then kills the app, upon reopening, they lose access to the active stream, making it impossible to cancel. Possible Solutions: B. Create a method to cancel all active streams and clear the foreground service. Note : Assume we are not using any third-party plugins like foreground_service or work_manager. |
I am facing the same issue, although in my case I'm currently testing on iOS. |
Please check the following before submitting a new issue.
Please select for which platform(s) you need help
Your question
our Android application initiates background location updates upon user login. However, upon user logout, it's essential to gracefully stop the background service responsible for location updates and unregister all associated listeners to optimize resource usage and ensure proper application behavior.
So How can we stop background service and dispose all listeners ( stream) in case of user logout or we want to stop listning the location on simple button click
Version
12.0.0
The text was updated successfully, but these errors were encountered: