Skip to content
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

Closed
eliaslecomte opened this issue Apr 1, 2020 · 5 comments
Closed

Comments

@eliaslecomte
Copy link

eliaslecomte commented Apr 1, 2020

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);

@zoontek
Copy link
Owner

zoontek commented Apr 1, 2020

Related to #354

@eliaslecomte
Copy link
Author

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'...

@zoontek
Copy link
Owner

zoontek commented Apr 1, 2020

I was not referring to the workaround here, but to the feature request. If it's implemented, will it resolve your issue?

@eliaslecomte
Copy link
Author

I was not referring to the workaround here, but to the feature request. If it's implemented, will it resolve your issue?

Yes :-)

@zoontek
Copy link
Owner

zoontek commented Apr 11, 2020

Shipped in the last version 🎉

@zoontek zoontek closed this as completed Apr 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants