react-native-geolocation
react-native-geolocation copied to clipboard
Split location manager into two managers to support observers and dir…
Overview
Split location manager into two managers to support observers and direct queries at the same time.
This PR does the following:
-
Add a new location manager instance to be used with the observer/watch calls. This means the observer can use different settings than the getCurrentPosition call, and the observer can use the significant changes API while still being able to do accurate requests
-
Add a bug fix where listening to updates would immediately return a recently cached value. This means the updates will be disabled right after, and we never get the final update. Observed behaviour mostly on the simulator when testing multiple locations.
-
getCurrentPosition no longer allows to use significant changes API (as documented, not a breaking a change)
Please review. The issue this PR fixes was not observed on Android, nor Android's react-native-geolocation-service (which should honestly be merged into this)
Test Plan
Tested on various iOS simulators using the location simulation feature. Tests were done using the watch/observe API with different settings (significant changes, high/low precision, etc) while also periodically requesting location with the getCurrentPosition call.
Lastly, tested on a real device (13.2.3)
Any reviews? Thoughts? Possible caveats?
Hey @cristianoccazinsp !
Thank you for this PR. I took over this library and I would like to land this PR. Are you interested in following it up?
It would be super helpful if you could point it to the next branch, rebase it and remove indentation changes.
Hi @michalchudziak , I actually switched to https://github.com/Agontuk/react-native-geolocation-service which proved to be much more reliable and customizable.
I completely understand! Good luck :)