I've tried the following in a number of 2.x android devices with phonegap version 2.0.0:
var onSuccess = function(position){
console.log("Success");
}
var onError = function(error){
console.log("Error");
}
gpsTrackWatchID = navigator.geolocation.watchPosition(
onSuccess,
onError,
{
enableHighAccuracy: true,
maximumAge: 5000,
timeout: 10000,
}
);
If I use the device indoors where there is no GPS signal onError is never called. The documentation states:
If the geolocationSuccess callback is not invoked within this time, the geolocationError callback will be invoked with a PositionError.TIMEOUT error code.
I've tried debugging this by putting a console.log in the watchPosition function in cordova.js, but the function seems never to be getting called. I wonder if the browser's native function is being executed instead of phonegap's?