Agontuk / react-native-geolocation-service

React native geolocation service for iOS and android
https://www.npmjs.com/package/react-native-geolocation-service
MIT License
1.61k stars 292 forks source link

Decreasing accuracy on refresh #274

Closed yogesch closed 3 years ago

yogesch commented 3 years ago

I have set up my code based off the example. So I have maximumAge 0, (android) accuracy high and enableHighAccuracy is true.

So the first time I click the button to fetch the location, it generally gets a decent accuracy (between 5 and 50, indoors on a cloudy day). Second time onwards, the accuracy keeps reducing until it stabilizes around 2000 - 2500. I am doing this sitting at my desk or going around the room.

If on the first attempt, I get a bad accuracy, I just need to open Google Maps and home in to my location and then this gets things right. If I have real time location sharing on Google Maps then this gets a good accuracy also.

The timestamp in all results is different and sometimes even the coordinates are slightly different. But I have observed that the coordinates/accuracy tends to fluctuate around the same set of values. That's probably because of the same computation being applied to impute the figure based on the error/accuracy.

I also tried out with the other package https://github.com/timfpark/react-native-location and if I set the provider to "playServices" it has the same problem. If however I set the provider to standard, it works better (although slower and less accurate (but well behaved)).

Might I be doing something wrong?

Edit: I also tried another library which uses the fused location provider and it has the same problem. https://github.com/douglasjunior/react-native-get-location

So I am now almost sure it has to do with the Play services / fused location. Googling around a bit, I did notice some issues about it, but I don't know enough about this stuff so go in the details. So I think I'll just use the location manager instead of services for now.

Agontuk commented 3 years ago

Yes, both location manager & fused location has their issues. Unfortunately we can't do anything about it, best option is to filter out inaccurate results.

Since this isn't an issue we can solve, I'll close this for now. Feel free to open new one if you find other issues.