react-native-geolocation icon indicating copy to clipboard operation
react-native-geolocation copied to clipboard

Split location manager into two managers to support observers and dir…

Open cristianoccazinsp opened this issue 5 years ago • 4 comments

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)

cristianoccazinsp avatar Dec 19 '19 06:12 cristianoccazinsp

Any reviews? Thoughts? Possible caveats?

cristianoccazinsp avatar Jan 13 '20 16:01 cristianoccazinsp

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.

michalchudziak avatar May 15 '22 13:05 michalchudziak

Hi @michalchudziak , I actually switched to https://github.com/Agontuk/react-native-geolocation-service which proved to be much more reliable and customizable.

cristianoccazinsp avatar May 15 '22 14:05 cristianoccazinsp

I completely understand! Good luck :)

michalchudziak avatar May 16 '22 17:05 michalchudziak