-
Why cordova geolocation watch doesn't working?
almost 10 years ago
-
almost 10 years ago
Hello Surdu ,
Well going through you code I think you are not using position detection trigger properly it has to be something like :
navigator.geolocation.watchPosition
Use it something like this :
var watchID = navigator.geolocation.watchPosition(onSuccess, onError, { timeout: 30000 });
function onSuccess(position) { var element = document.getElementById('geolocation'); element.innerHTML = 'Latitude: ' + position.coords.latitude + '
' + 'Longitude: ' + position.coords.longitude + '
' + '
' + element.innerHTML; }// onError Callback receives a PositionError object // function onError(error) { alert('code: ' + error.code + '\n' + 'message: ' + error.message + '\n'); }
If you use the above example properly I think you will be able to get the position on change .
If the issue still exist please let us know
-
1 Answer(s)