Closed StijnWoerkom closed 4 years ago
Any progress here?
@DenisBogatirov this is supported since the last official version of the plugin. Depending on what you have listed in your AndroidManifest.xml
file you can request permissions to access location services.
Depending on the supplied enum value you request the following permissions:
ACCESS_COARSE_LOCATION
and / or ACCESS_FINE_LOCATION
permissions in your AndroidManifest.xml file (on Android Q this means "Keep while in use");ACCESS_BACKGROUND_LOCATION
permissions on Android Q and newer. Otherwise it defaults back to the old permission system;AndroidManifest.xml
file and which permissions the user selected in the dialog (on Android Q and newer). Otherwise it will default back to the old behaviour.@mvanbeusekom , thanks for the explanation. I believe this related to the issue #41 I created recently. My app needs ACCESS_BACKGROUND_LOCATION to work perfectly, but it may work with limited functionality with WHEN_IN_USE.
In this case, I understand that I have to add ACCESS_BACKGROUND_LOCATION to AndroidManifest.xml. Correct?
And how can I tell if the user granted ALWAYS or WHILE_IN_USE? This is necessary for the app to adjust its behavior properly.
@DenisBogatirov this is supported since the last official version of the plugin. Depending on what you have listed in your
AndroidManifest.xml
file you can request permissions to access location services.Depending on the supplied enum value you request the following permissions:
- LocationPermissionLevel.locationWhenInUse: this maps to the
ACCESS_COARSE_LOCATION
and / orACCESS_FINE_LOCATION
permissions in your AndroidManifest.xml file (on Android Q this means "Keep while in use");- LocationPermissionLevel.locationAlways: this maps to the
ACCESS_BACKGROUND_LOCATION
permissions on Android Q and newer. Otherwise it defaults back to the old permission system;- LocationPermissionLevel.location: this will try to be smart and see what is in you
AndroidManifest.xml
file and which permissions the user selected in the dialog (on Android Q and newer). Otherwise it will default back to the old behaviour.
:sparkles: What kind of change does this PR introduce? (Bugfix, feature, docs update...)
New feature
:arrow_heading_down: What is the current behavior?
The current behavior of the plugin automatically returns Permission.denied and doesn't respect granted permissions.
:new: What is the new behavior (if this is a feature change)?
WhileInUse feature
:boom: Does this PR introduce a breaking change?
:bug: Recommendations for testing
Code review
:memo: Links to relevant issues/docs
https://github.com/Baseflow/flutter-permission-plugins/issues/21
:thinking: Checklist before submitting