flutter-geolocator
flutter-geolocator copied to clipboard
[Question]: how can start when i cancel and restart
Please check the following before submitting a new issue.
- [X] I have searched the existing issues.
- [X] I have carefully read the documentation.
Please select for which platform(s) you need help
- [X] Android
- [X] iOS
- [ ] Linux
- [ ] macOS
- [ ] Web
- [ ] Windows
Your question
i can cancel and how can re-start? resume -> only pause and next action cancel -> ???
Version
11.0.0
Is there any update?
I also want to 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?
init
StreamSubscription<Position>? positionStream;
positionStream =
Geolocator.getPositionStream(locationSettings: locationSettings).listen(
(Position? position) async {})....
cancel
if (positionStream != null) {
positionStream?.cancel();
positionStream = null;
}
re-start
positionStream =
Geolocator.getPositionStream(locationSettings: locationSettings).listen(
(Position? position) async {})....
i use
@kindkmj when user close/exit the app after start location tracking than again open it how can i find reference of positionStream.
Also does positionStream?.cancel(); automatically dismiss the foreground service notification ?
If positionStream?.cancel(); no further location collection has taken place. However, there were intermittent cases where collection continued even if canceled occasionally, but it was different for each project. I need to send a location collection notification to the user I also used the location package.
@TimHoogstrate please let me know what info you need.
Dear @mayank-vinove,
Please elaborate a bit on the subject. Try to explain what you have done so far and what you want to achieve?
Kind regards,
@TimHoogstrate
Check https://github.com/Baseflow/flutter-geolocator/issues/1536