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:
- using
getCurrentPosition()
first, to get a first/warm-up reading (usually very OFF target), discard it and get thewatchPosition()
reading (results are not significantly better) - 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