dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.04k stars 1.73k forks source link

Maui Essentials Permissions CheckStatusAsync<LocationWhenInUse> Or CheckStatusAsync<LocationAlways> returns Denied instead of restricted #23060

Open mh05 opened 3 months ago

mh05 commented 3 months ago

Description

I am using Permission to get and/or check the users location Permission on API 31 or API 34. When checking the current permission status it will returns PermissionStatus.Denied even when RequestAsync returns PermissionStatus.Restricted

I found a related issue in the Maui repo: https://github.com/dotnet/maui/issues/10053 and it seems to be fixed.

iOS is working as far as i know

Note: The Microsoft.Maui.Essentials" Version="9.0.0-preview.5.24307.10" encounters the same error. Manifest :

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

Steps to Reproduce

  1. Add all permissions to Manifest.xml
  2. Call await Permissions.CheckAsync();
  3. Which shows a popup asking whether you allow approximate location, precise location or not allow location at all.
  4. Select approximate location.
  5. It returns PermissionStatus.Restricted;
  6. Call await Permissions.CheckStatusAsync();
  7. It returns value PermissionStatus.Denied

Link to public reproduction project repository

No response

Version with bug

8.0.40 SR5

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android API 31+

Did you find any workaround?

No response

Relevant log output

No response

github-actions[bot] commented 3 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Zhanglirong-Winnie commented 3 months ago

Verified this issue with Visual Studio 17.11.0 Preview 2.0 (8.0.40). Not repro on Android(API31 or API34) platform. image

mh05 commented 3 months ago

Verified this issue with Visual Studio 17.11.0 Preview 2.0 (8.0.40). Not repro on Android(API31 or API34) platform. image

Hi @Zhanglirong-Winnie.

Sorry for the lack of clarity and the wrong steps .2nd step should be Permissions.CheckAsync() instead of RequestAsync. (I did change my openingspost)

Summary:

I Added a project to check PermissionTest

Zhanglirong-Winnie commented 3 months ago

This issue has been verified using Visual Studio 17.11.0 Preview 2.1 (8.0.40 ). Can be reproduced on android platform with sample project.