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

how to stop location tracking #1

Open
rajatjain7869 opened this issue Feb 22, 2020 · 2 comments
Open

how to stop location tracking #1

rajatjain7869 opened this issue Feb 22, 2020 · 2 comments

Comments

@rajatjain7869
Copy link

this is Good example for live tracking but how we will stop the location updates or you can say location listener updates

@romanejaquez
Copy link
Owner

romanejaquez commented Feb 22, 2020

@rajatjain7869 if you want to stop location updates, you have to capture the stream subscription from the location.onLocationChanged().listen, as such:

locationData = location.onLocationChanged().listen((LocationData cLoc) {
currentLocation = cLoc;
updatePinOnMap();
});

then anywhere you want to stop it, then you say:

locationData.cancel() or locationData.pause();

if you want to pick it back up, then you say:

locationData.resume();

Hope that helps!

@sokunsamnang
Copy link

@rajatjain7869 if you want to stop location updates, you have to capture the stream subscription from the location.onLocationChanged().listen, as such:

locationData = location.onLocationChanged().listen((LocationData cLoc) {
currentLocation = cLoc;
updatePinOnMap();
});

then anywhere you want to stop it, then you say:

locationData.cancel() or locationData.pause();

if you want to pick it back up, then you say:

locationData.resume();

Hope that helps!

aftter add .cancel(); or .pause(); , function showPinsOnMap(); not load (sourcePinInfo, destinationPinInfo).

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

No branches or pull requests

3 participants