iOS module implementation
See original GitHub issueHello guys, due to the pandemic I’ve some free time now. So I decided to learn a little bit of swift and try to implement my own geolocation module for iOS. I’ll be updating this thread as I implement features one by one. You can track the progress here.
https://github.com/Agontuk/react-native-geolocation-service/tree/next
If you have any suggestions, feel free to share here.
TODO
- requestAuthorization
- getCurrentPosition
- startObserving
- stopObserving
- Background location update
API Changes
-
setRNConfiguration (deprecated) Currently it has two options
skipPermissionRequests
&authorizationLevel
. Both of them will become unused because of the changes inrequestAuthorization
as described below. -
async requestAuthorization(authorizationLevel) You must call this method with your desired permission level before requesting location, thus removing the necessity of
skipPermissionRequests
&authorizationLevel
. Furthermore, this method now returns a promise which you can use to check the authorization status and take necessary actions.const status = await Geolocation.requestAuthorization("whenInUse"); // or "always" console.log(status); // "disabled", "granted", "denied", "restricted"
-
getCurrentPosition() Removed async keyword, since it’s not an async function. Also removed
useSignificantChanges
option cause it’s not needed for single location update.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:13
- Comments:7 (4 by maintainers)
Top GitHub Comments
iOS implementation is done, I’ll merge this into master soon. If anyone has any suggestion or faced any issue, let me know.
No, react-native-geolocation dependency is removed in v5.0.0