Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.

[Bug] Android 12 Coarse Location Permission is returning Denied StatusΒ #1999

@Cheesebaron

Description

@Cheesebaron

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

  1. set android:targetSdkVersion="31" and TFM to 12 or higher
  2. Check permisison with await Permissions.CheckStatusAsync<Permissions.LocationWhenInUse>();
  3. 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

Screenshots

Screenshot_20220422-140530

Reproduction Link

Metadata

Metadata

Assignees

No one assigned

    Labels

    androidThis issue impacts AndroidbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions