My code for getting a location is something like that:
navigator.geolocation.getCurrentPosition(
(succes) => {
if (document.getElementById('hiddenDivLatitude'))
document.getElementById('hiddenDivLatitude').value = succes.coords.latitude;
if (document.getElementById('hiddenDivLongitude'))
document.getElementById('hiddenDivLongitude').value = succes.coords.longitude;
alert('S-au identificat urmatoarele coordonate: \r\nlat: ' + succes.coords.latitude.toFixed(6) + ', long: ' + succes.coords.longitude.toFixed(6));
document.forms[0].submit();
},
(error) => {
var errorMessage = error.code;
switch (error.code) {
case error.PERMISSION_DENIED:
errorMessage = "User denied the request for Geolocation."
break;
case error.POSITION_UNAVAILABLE:
errorMessage = "Locatia nu se poate prelua."
break;
case error.TIMEOUT:
errorMessage = "Timeout. Mai incearca o data."
break;
case error.UNKNOWN_ERROR:
errorMessage = "Nu se pot prelua coordonatele."
break;
}
alert(errorMessage);
x.innerHTML = errorMessage;
},
{
enableHighAccuracy: true,
maximumAge: 0,
timeout: 20000
}
)
I specify that property maximumAge is set to 0 so the device should retrieve the newest location. The device retrieves location in the following manner:
44.433329 26.0369307,
44.433329 26.0369307,
44.433329 26.0369307,
44.433329 26.0369307,
44.4333286 26.0369289,
44.4347303 26.0286253,
44.4347303 26.0286253
And I really do not understand why the cache location doesn't reset immediately. I specify that the browser being used is Chrome and the device OS is Android.