-
Notifications
You must be signed in to change notification settings - Fork 497
[Bug] Android 12 Coarse Location Permission is returning Denied StatusΒ #1999
Description
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
- set
android:targetSdkVersion="31"
and TFM to 12 or higher - Check permisison with
await Permissions.CheckStatusAsync<Permissions.LocationWhenInUse>();
PermissionStatus
will always be "Denied" if you selected approximate location when requsting
Expected Behavior
Some kind of granularity to know which of the two requested permissions in LocationWhenInUse
have been permitted by the user.
Actual Behavior
PermissionStatus
is Denied
if "Approximate" is selected
Basic Information
- Version with issue:
- Last known good version:
- IDE:
- Platform Target Frameworks:
- Android: 12
- Nuget Packages:
- Affected Devices: All Android 12 and up when targeting Android 12