I did that, but you're pointing out a mistake.

Error: 
"Uncaught TypeError: Failed to execute 'watchPosition' on 'Geolocation': The 
callback provided as parameter 1 is not a function."

```
let watchLocation
let locationLastUpdateTime = null
let locationMinUpdateFrequency = 15 * 1000 

this.watchLocation = navigator.geolocation.watchPosition({enableHighAccuracy: 
true})
    .filter((p) => p.coords !== undefined)
    .subscribe(position => {
        console.log('position: ', position, 'L: ', position.coords.longitude + 
' ' + position.coords.latitude)
        
        let now = new Date();
        let duration
        try {
            duration = now.getTime() - this.locationLastUpdateTime.getTime()
        } catch (error) {
            duration = 999999999
        }

        if (this.locationLastUpdateTime == null || duration >= 
this.locationMinUpdateFrequency) {
            console.log('Update is needed: ', duration)
            myLocation()
            this.locationLastUpdateTime = now;
        } else {
            console.log('Ignore position update: ', duration);
        }
    })
```



[ Full content available at: 
https://github.com/apache/cordova-plugin-geolocation/issues/115 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to