Skip to content

Commit 85bde74

Browse files
kubafloPureWeen
authored andcommitted
Requesting permissions using RequestAsync while the app is in the background - fix (#30697)
1 parent aac0293 commit 85bde74

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Essentials/src/Permissions/Permissions.android.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ public override async Task<PermissionStatus> RequestAsync()
102102
return PermissionStatus.Granted;
103103

104104
var permissionResult = await DoRequest(runtimePermissions);
105-
if (permissionResult.GrantResults.Any(g => g == Permission.Denied))
105+
// OnRequestPermissionsResult can be called with an empty grantResults array if the user interaction was interrupted.
106+
// Ignoring this could lead to incorrect assumptions that permissions were granted.
107+
if (permissionResult.GrantResults.Length == 0 || permissionResult.GrantResults.Any(g => g == Permission.Denied))
106108
return PermissionStatus.Denied;
107109

108110
return PermissionStatus.Granted;

0 commit comments

Comments
 (0)