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
[Bug] Android 12 Coarse Location Permission is returning Denied Status #1999
Comments
Are you sure you're using the latest version? We did some fixes around this. |
@jfversluis I fixed RequestAsync. This is a different method/code path. |
5 tasks
@Cheesebaron would you be able to test the resulting NuGet from the linked PR and see if that has the desired result? If so, I can add it to the next release I want to put out this week/early next week. |
Yep, will give it a spin and see how it behaves |
jfversluis
added a commit
that referenced
this issue
May 6, 2022
…eckstatusasync Fix #1999 - checkasync should return restricted for locationinuse whe…
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
If you request LocationWhenInUse permission targeting Android 12, it shows a nice pop-up, where you can select the precision of the permission you want to grant. Either Approximate (coarse) or Precise (fine).
If you only allow Approximate, the CheckAsync will always return "Denied" status, even though permission was granted.
There is no way of defining what you want.
Both fine and coarse is requested:
https://github.com/xamarin/Essentials/blob/main/Xamarin.Essentials/Permissions/Permissions.android.cs#L232-L233
Seems like it happens in this part of the code when checking permissions: https://github.com/xamarin/Essentials/blob/main/Xamarin.Essentials/Permissions/Permissions.android.cs#L82
You simply just return the status of the first, even though there might be other permissions that have been granted.
Steps to Reproduce
android:targetSdkVersion="31"
and TFM to 12 or higherawait Permissions.CheckStatusAsync<Permissions.LocationWhenInUse>();
PermissionStatus
will always be "Denied" if you selected approximate location when requstingExpected Behavior
Some kind of granularity to know which of the two requested permissions in
LocationWhenInUse
have been permitted by the user.Actual Behavior
PermissionStatus
isDenied
if "Approximate" is selectedBasic Information
Screenshots
Reproduction Link
The text was updated successfully, but these errors were encountered: