luisfernando-rf commented on issue #115: Frequency/Interval feature for `watchPosition` URL: https://github.com/apache/cordova-plugin-geolocation/issues/115#issuecomment-427926084 I did it this way, but you're looking at me in error. 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); } })`
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org