Hello,
After my testing, the method if (status != PermissionStatus.Granted)
after clicking on deny overrides the method in if (Permissions.ShouldShowRationale<Permissions.LocationWhenInUse>())
.
For requesting Location permissions, there are out-of-the-box examples in the official example, please refer to the documentation and code snippets:
public async Task<PermissionStatus> CheckAndRequestLocationPermission()
{
PermissionStatus status = await Permissions.CheckStatusAsync<Permissions.LocationWhenInUse>();
if (status == PermissionStatus.Granted)
return status;
if (status == PermissionStatus.Denied && DeviceInfo.Platform == DevicePlatform.iOS)
{
// Prompt the user to turn on in settings
// On iOS once a permission has been denied it may not be requested again from the application
return status;
}
if (Permissions.ShouldShowRationale<Permissions.LocationWhenInUse>())
{
// Prompt the user with additional information as to why the permission is needed
await Shell.Current.DisplayAlert("Needs permissions", "BECAUSE!!!", "OK");
}
status = await Permissions.RequestAsync<Permissions.LocationWhenInUse>();
return status;
}
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.