michalchudziak / react-native-geolocation

Geolocation APIs for React Native
MIT License
1.28k stars 220 forks source link

Set background location enabled if not requesting permissions #232

Closed naftalibeder closed 1 year ago

naftalibeder commented 1 year ago

By default, the iOS permission request flow runs

[_locationManager setAllowsBackgroundLocationUpdates:YES];

but if skipPermissionRequests is true, the entire flow is skipped, meaning background location updates are never enabled. This enables them when skipping permission requests.

Note: technically, background location updates are possible whether the authorization level is always or when in use - potentially, this should just become a configuration option, e.g. GeolocationConfiguration.enableBackgroundLocationUpdates. Thoughts?

michalchudziak commented 1 year ago

Hey, thank you for the PR. I think we should give users more control over when this permission is or isn't requested. I like the idea of adding a configuration option. Would you like to refactor it in that way?