0

Geo-location watch only fires every minute. Using a Nexus-5, android 4.4.2, and cordova 3.3.1 (I've also tried 3.4.0). It makes no difference what I define maximumAge as. The location returned is correct. In other devices I have have tested it gets fired every second. I know I can fall back on using setTimeout with getCurrentPosition, but I'd like to understand this behaviour.

navigator.geolocation.watchPosition(
    function(){
        console.log("success");
    },
    function(){
        console.log("fail");
    },
    {
        enableHighAccuracy: true,
        timeout: 30000
    }
);
gmh04
  • 1,351
  • 9
  • 24
  • Are you using the [Geolocation Plugin](https://github.com/apache/cordova-plugin-geolocation/blob/dev/doc/index.md) or just the HTML5 Geolocation API? Because the Geolocation Plugin is not that great, and will actually be [deprecated](https://issues.apache.org/jira/browse/CB-5977) in the next Cordova release. They suggest that you just use the HTML5 Geolocation API. – Andrew Lively Mar 26 '14 at 14:43
  • Yes the plugin was enabled, removing it fixes it. If you put your comment as an answer I've give you a big tick! – gmh04 Mar 26 '14 at 15:04

1 Answers1

2

The Geolocation Plugin is not that great, and will actually be deprecated in the next Cordova release. They suggest that you just use the HTML5 Geolocation API instead, which uses the same syntax.

Andrew Lively
  • 2,145
  • 2
  • 20
  • 27