-
-
Notifications
You must be signed in to change notification settings - Fork 846
Description
Question
With Android 10, you can request location access in the foreground or in the background.
According the Android documentation (https://developer.android.com/training/location/request-updates), you can request them at the same time:
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_BACKGROUND_LOCATION),
This results in a permission request dialog with 3 options (all the time, only when in app, deny).
How to do this with react-native-permissions?
The only option I see is to first request ACCESS_FINE_LOCATION and then ACCESS_BACKGROUND_LOCATION but this requests in the user having to approve twice :-(.
So the only option now is:
const locationResult = await request(PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION); const backgroundResult = await request(PERMISSIONS.ANDROID.ACCESS_BACKGROUND_LOCATION);