Capacitor geolocation watchPosition() is off target for first readings

Using capacitor’s watchposition() I get the first few readings off target but then it improves to a reasonable accuracy. Seems like a “warm-up” delay or that the watchPosition() method takes too long to update… Is there a way to speed the “warm-up”/update process?

Here is an example:

Target 4.7297676,-74.0492548

Reading #
(1) 4.64891,-74.05573 → OFF
(2) 4.7297727,-74.0492353 → OK
(3) 4.7295307,-74.0490807 → OK
(4) 4.7295301,-74.0490604 → OK

In this simple example, the first reading is off but in practice the number of wrong readings is kind of random.

The issue is that based on the first readings certain app logic is triggered and if the position is the wrong one, the user experienced will be degraded.

Is this normal behaviour? Can I do something to “warm up” things faster (I don’t want the user to wait too long…)?

Already tried the following with no success:

  1. using getCurrentPosition() first, to get a first/warm-up reading (usually very OFF target), discard it and get the watchPosition() reading (results are not significantly better)
  2. discard the first 2 readings from watchPosition() (improves a little bit, but user may wait too long)

watchPosition() implementation

this.watchId = await Geolocation.watchPosition(
      { enableHighAccuracy: true,
        maximumAge : 0
      },
      (data) => {
        try {
          // do something with data
        } catch (e){
// do something with error
        }
        
      }
    );

Thanks

I’m having the same problem and having lots of issues with position. I get the position always off by some amount (1-30 metres) and sometimes it bounces around.

Do I need to explicitly request permissions? It asks me for permissions anyway and seems to “work” but not very well.

I am clicking on the ‘precise location’ option in the permission request dialog.

I had a lot of problems even finding a working example of watchPosition…