So I am seeing an issue where the GetCurrentPosition call is not pulling the devices position every time the call is made.
Ie. I have a button that i can press to call GetCurrentPosition. On the initial press it returns the Position. If i press it again, the call immediately returns the same Position as if it is pulling from Cache.
await Geolocation.getCurrentPosition({
enableHighAccuracy: true,
timeout: 10000,
maximumAge: 1
}).then((resp) => {
console.log(resp);
position = resp;
})
.catch((error) => {
console.log('Error getting location for weather marker', error);
});
Even though maximum age by default is 0, it is about 8-10s before it will actually return a new Position. I set the maximumAge to 1ms but that doesnt change anything.
I am aware of the watchPosition and its purpose to be a polling return of position but that isnt what I am looking for.
In a nut shell i have a button on the map that can be pressed to check the “Accuracy” of where your device thinks you are compared to where you actually are. They can press said button to drop a pin of where the device thinks they are. The idea is that they should be able to press this button on demand to see how accurate they are before performing tasks with the map.
The issue is the press the button and see they are not accurate. They walk 10 ft and press again, nothing happens, their position isnt updated. It would take 10s or so before pressing the button will yield a new Position is returned from the device.
However, if they switch applications to google maps and that registers a more accurate location ( which i have found is extremely more accurate then GetCurrentPosition) and then switches back to our application, the position will then change when the button clicked.
Is there a reason GetCurrentPosition is not returning a fresh location from the device hardware on each request?