How to prevent multiple watchLocation listeners ?
See original GitHub issueHi,
Is there some option to stop all active watchLocation listeners started from the app ?
In my case I have component which starts watchLocation listener every time when is visited. The problem is the previous listeners don’t stop to listen for gps location ( and i have multiple active listeners for gps location ).
How can i stop them without to know their watch IDs ?
I tried with simple check :
if ( !this.watchId ) {
this.watchId = geolocation.watchLocation(this.locationReceived, this.error, {
desiredAccuracy: 20,
updateDistance: 0,
minimumUpdateTime: 15000,
maximumAge: 6000
});
}
But every time this watchID is different for each new visit in the component and accordingly it`s not created ( this doesn’t work ) .
Thanks for help !
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
geolocation watchposition multiple locations? - Stack Overflow
I got it solved, the problem was that I was putting the listener event out of the marker object, so the marker variable...
Read more >Geolocation API. As a web developer sooner or later… - Medium
watchPosition ( // the same as getCurrentPosition, but called multiple times );. Note: This method is basically event listener, so you can ...
Read more >Geolocation clearWatch() seems not to stop GPS tracking
When i start checking geolocation with navigator.geolocation.watchPosition() (cordova-plugin-geolocation is installed), and want to stop it, ...
Read more >Geolocation.watchPosition() - Web APIs | MDN
The Geolocation method watchPosition() method is used to register a handler function that will be called automatically each time the ...
Read more >BackgroundGeolocation | React Native Background Geolocation
Interacting with the SDK is largely through implementing listeners on the ... the plugin requests multiple location samples in order to record the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@devyaz - no
On Sat, Sep 22, 2018, 2:16 AM devyaz notifications@github.com wrote:
here: