-
-
Notifications
You must be signed in to change notification settings - Fork 836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to request both ACCESS_BACKGROUND_LOCATION and ACCESS_FINE_LOCATION #435
Comments
Related to #354 |
The workaround is a bit dull as that results in the user first getting a location permission popup with options 'in the app, deny', and then a second one with 'always, in the app, deny'... |
I was not referring to the workaround here, but to the feature request. If it's implemented, will it resolve your issue? |
Yes :-) |
Shipped in the last version 🎉 |
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);
The text was updated successfully, but these errors were encountered: