Capacitor Geolocation GetCurrentPosition not pulling position every call

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) => {
      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?

Not sure if this forum or the github is more proper. Maybe make sure to post in both places?

Is your device set to “high accuracy mode” when testing?

We are using LocationManager.getLastKnownLocation() on Android and CLLocationManager locations on iOS, both of which cache the last known location, which the OS updates periodically. Unlike the web implementation, the way we are doing just requests the cache to update more quickly and doesn’t invalidate the cache like the web implementation. You should use the watch mode to continuously poll when users enter the “map mode” to get more accurate location data. The geolocation plugin uses the standards on iOS and Android but if you need more immediate location data, you can prompt it via a custom plugin.

You could also open a feature request on the Capacitor Plugins repo and request that our request to the OS is a lower amount.