michalchudziak / react-native-geolocation

Geolocation APIs for React Native
MIT License
1.34k stars 238 forks source link

Passing enableBackgroundLocationUpdates is ignored #316

Open tanoc opened 6 months ago

tanoc commented 6 months ago

Platforms

iOS

Versions

Description

It looks like the function converting between the js dictionary and the RNCGeolocationConfiguration struct does not set enableBackgroundLocationUpdates:

https://github.com/michalchudziak/react-native-geolocation/blob/7bd62fd3cc2898a11d9ded1ad7840d849b8a5a82/ios/RNCGeolocation.mm#L61-L69

I notice this because enableBackgroundLocationUpdates is never called with skipPermissionRequests set to true because _locationConfiguration.enableBackgroundLocationUpdates is always set to false

https://github.com/michalchudziak/react-native-geolocation/blob/7bd62fd3cc2898a11d9ded1ad7840d849b8a5a82/ios/RNCGeolocation.mm#L176-L180

tomthought commented 1 month ago

Experiencing this as well.

Looks like just need to add something like this: .enableBackgroundLocationUpdates = [RCTConvert BOOL:options[@"enableBackgroundLocationUpdates"]]