How do you request runtime permissions in MAUI?
Short answer
Use the Permissions API: check the status with CheckStatusAsync and request with RequestAsync for a permission type (e.g., LocationWhenInUse, Camera). Declare the permission in each platform manifest (AndroidManifest.xml, Info.plist). Handle Denied and Disabled states gracefully.
Advertisement
AModel answer
Use the Permissions API: check the status with CheckStatusAsync and request with RequestAsync for a permission type (e.g., LocationWhenInUse, Camera). Declare the permission in each platform manifest (AndroidManifest.xml, Info.plist). Handle Denied and Disabled states gracefully.
var status = await Permissions.CheckStatusAsync<Permissions.Camera>();
if (status != PermissionStatus.Granted)
status = await Permissions.RequestAsync<Permissions.Camera>();Real-world example
Before opening the camera, the app checks and requests camera permission, showing a rationale if the user previously denied it.
Likely follow-ups
- Where do you declare permissions per platform? | How do you handle a denied result?
Related topics