I have a few GPS location request through out my HTML file embedded in other functions. I am facing a problem that, when the app is opened if the location isnt on(Or location is switched off after the request is fired). Then i would have to restart the app inorder for the location request to work again.
If it fails once, then even the location is switched backon, every single request after that would be an error.
Why does that happen?
var Geo11={};
navigator.geolocation.getCurrentPosition(success11,error11, { enableHighAccuracy: true, maximumAge: 5000, timeout: 20000 });
//Get the latitude and the longitude;
function success11(position) {
Geo11.lat = position.coords.latitude;
Geo11.lng = position.coords.longitude;
calcRoute(Geo11.lat, Geo11.lng);
}
function error11(error){
alert('Please check your GPS setting, then reload.');
}