Closed wuppious closed 2 years ago
I believe it's a mistake! But you solve my problem!
The
maximumAge
option seems to be in seconds, not in milliseconds like described in the documentation. App is using the fused location provider.
How are you verifying this ? maximumAge
is in milliseconds as far as I know.
getCurrentPosition
returns near immediately and the result contains the 'heading', which does not change at all between requests if I set the maximumAge
to 5000 but does change if set to 5.
Edit: I mean it changes with 5 second intervals. Obviously inbetween you'll receive cached results.
If you're getting same results, check the timestamp. If it's different every time, that means fused provider thinks you're still in the same location. That's why it returning old data, but with new timestamps.
I checked the code, maximumAge
is being used as milliseconds. So I don't think it's the real issue.
I'll provide you with better info next week if I remember. In any case treating maximumAge
as seconds resulted in the expected and intended behaviour – atleast in my case.
I'm on Android 11 and Google Play Services 21.15.15 if those help.
I am using Geolocation.watchPosition
, and I feel like interval
is not in ms
but in centisecond
. I set it to 1000
, and the location updates about every 10 seconds. When I set it to 100
, it updates every second.
Looking at the source code, there are default variables you will need to overwrite in order to get the application to work as indented.
The default interval is 10 seconds and the default fastestInterval is 5 seconds. You must override both of these. There is also a distanceFilter of 100m you need to override.
Try a minimum of:
{ fastestInterval: 0, distanceFilter: 0 }
With just those options I got 1 second updates.
Closing due to inactivity, also I'm confident that this is working as expected. Feel free to open a new issue if that's not the case.
React Native:
0.64.0
Library version:5.3.0-beta.1
,5.2.0
Device: Samsung Galaxy A71The
maximumAge
option seems to be in seconds, not in milliseconds like described in the documentation. App is using the fused location provider.