Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

How to prevent multiple watchLocation listeners ?  #46

@Syler921

Description

@Syler921

Hi,

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 !

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions