Closed gktval closed 9 months ago
I don't believe that's an MAUI issue: I believe that's what happens for Android applications in general and is not specific to MAUI. If you created an Android app in straight .NET or Java and denied the permissions, you would need to reset them through the settings app. Unless I'm mistaken, IMO, we shouldn't do something special for MAUI UI apps specifically in this regard.
@jonathanpeppers Is this correct?
The code looks like it just calls Android to request every time:
@gktval if you want to validate Essential's behavior, you could try calling the Android APIs directly:
If you get the same behavior, calling directly (not using Essentials), then it's likely "just how Android works".
You might look into adb shell pm
, as a another way to debug:
adb shell pm [grant|revoke] com.my.app android.permission.ACCESS_FINE_LOCATION
There are some examples in adb shell pm help
output:
grant [--user USER_ID] PACKAGE PERMISSION
revoke [--user USER_ID] PACKAGE PERMISSION
These commands either grant or revoke permissions to apps. The permissions
must be declared as used in the app's manifest, be runtime permissions
(protection level dangerous), and the app targeting SDK greater than Lollipop MR1.
set-permission-flags [--user USER_ID] PACKAGE PERMISSION [FLAGS..]
clear-permission-flags [--user USER_ID] PACKAGE PERMISSION [FLAGS..]
These commands either set or clear permission flags on apps. The permissions
must be declared as used in the app's manifest, be runtime permissions
(protection level dangerous), and the app targeting SDK greater than Lollipop MR1.
The flags must be one or more of [review-required, revoked-compat, revoke-when-requested, user-fixed, user-set]
Thanks. I tried calling adb shell pm clear-permission-flags PACKAGE_NAME PERMISSION_NAME user-set user-fixed as shown here: https://developer.android.com/about/versions/11/privacy/permissions
Coarse and Fine location do have the USER_SET flag. After calling the command above, it removes the USER_SET flag. But if I reinstall, the flag gets set again.
I think it's just how Android works:
Permissions that have been denied once by the user are flagged by USER_SET. Permissions that have been denied permanently by selecting Deny twice are flagged by USER_FIXED.
During testing you might want to reset these flags to ensure that testers aren't surprised when the request dialog isn't shown. To do this, use the command:
adb shell pm clear-permission-flags PACKAGE_NAME PERMISSION_NAME user-set user-fixed
Default Android behavior, there is not much we can do here on our side unfortunately.
Description
Several months ago, while testing, I chose to deny permission to my app when asking for LocationWhenInUse. Since then, whenever I reinstall the app and need to ask for permissions again, this permission is always denied. The screen to ask for permissions never pops up. Instead, I must go into the settings for the app on the device and manually allow access to Location. I have only noticed this affecting Android.
I feel like after clearing the cache or reinstalling the app, that this permission should be reset.
Steps to Reproduce
Relevant Code: BasePermission gpsPermission = new LocationWhenInUse(); var permissionStatus = await permission.CheckStatusAsync(); Console.WriteLine(permissionStatus);
Link to public reproduction project repository
NA
Version with bug
7.0.92
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
7.0.92
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
No
Relevant log output
No response