
Maui Permissions
- 46 installs
- 163 repo stars
- Updated July 6, 2026
- davidortinau/maui-skills
Handles .NET MAUI runtime permissions including checking and requesting permissions, PermissionStatus handling, and platform manifest declarations.
About
Guides .NET MAUI runtime permissions covering checking and requesting permissions, PermissionStatus handling, custom permissions and platform manifest/plist declarations. A developer uses it when managing runtime permissions in a MAUI app.
- Checking and requesting permissions with PermissionStatus handling
- Custom permissions and platform manifest/plist declarations
Maui Permissions by the numbers
- 46 all-time installs (skills.sh)
- Ranked #608 of 1,039 Mobile Development skills by installs in the Skillselion catalog
- Data as of Aug 3, 2026 (Skillselion catalog sync)
npx skills add https://github.com/davidortinau/maui-skills --skill maui-permissionsAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 46 |
|---|---|
| repo stars | ★ 163 |
| Last updated | July 6, 2026 |
| Repository | davidortinau/maui-skills ↗ |
What it does
Handles .NET MAUI runtime permissions including checking and requesting permissions, PermissionStatus handling, and platform manifest declarations.
Files
.NET MAUI Permissions — Gotchas & Best Practices
Critical Anti-Patterns
1. Requesting without checking first
// ❌ Shows prompt even if already granted
var status = await Permissions.RequestAsync<Permissions.Camera>();
// ✅ Check first — avoids unnecessary prompts
var status = await Permissions.CheckStatusAsync<Permissions.Camera>();
if (status != PermissionStatus.Granted)
status = await Permissions.RequestAsync<Permissions.Camera>();2. Calling permissions in a constructor
Permission APIs are async and require a UI context. Constructors can't await.
// ❌ Blocks the UI thread or throws
public MyViewModel()
{
var status = Permissions.RequestAsync<Permissions.Camera>().Result;
}
// ✅ Use OnAppearing, a command, or async initialization
protected override async void OnAppearing()
{
await CheckAndRequestPermissionAsync<Permissions.Camera>();
}3. Ignoring Denied and Restricted status
// ❌ Only checks for Granted — misses edge cases
if (status == PermissionStatus.Granted) { /* proceed */ }
// ✅ Handle all relevant statuses
switch (status)
{
case PermissionStatus.Granted: /* proceed */ break;
case PermissionStatus.Limited: /* iOS partial access */ break;
case PermissionStatus.Denied:
case PermissionStatus.Restricted:
await ShowSettingsPromptAsync(); break;
}Platform Pitfalls
⚠️ iOS: One-shot permission dialog
iOS shows the system permission dialog only once per permission, ever. After denial, RequestAsync returns Denied immediately without showing UI. You must guide the user to Settings → App → Permission.
⚠️ Android: ShouldShowRationale timing
ShouldShowRationale returns true only after a prior denial (but not after "Don't ask again"). Use it to show explanatory UI before re-requesting:
if (Permissions.ShouldShowRationale<Permissions.Camera>())
{
await Shell.Current.DisplayAlert("Permission needed",
"Camera access is required to scan barcodes.", "OK");
}
status = await Permissions.RequestAsync<Permissions.Camera>();⚠️ Android API 33+: StorageRead/StorageWrite are dead
On Android 13+, StorageRead and StorageWrite always return Granted (scoped storage makes them meaningless). Use granular media permissions instead:
// ❌ Always returns Granted on API 33+ — gives false confidence
await Permissions.RequestAsync<Permissions.StorageRead>();
// ✅ Use the specific media permission
await Permissions.RequestAsync<Permissions.Photos>(); // photo access
await Permissions.RequestAsync<Permissions.Media>(); // audio/video⚠️ Windows: Most permissions always return Granted
Windows doesn't have runtime permission dialogs for most features. Declare capabilities in Package.appxmanifest instead.
Always-Check-Before-Request Pattern
The recommended pattern handles iOS one-shot and Android rationale:
public async Task<PermissionStatus> CheckAndRequestPermissionAsync<T>()
where T : Permissions.BasePermission, new()
{
var status = await Permissions.CheckStatusAsync<T>();
if (status == PermissionStatus.Granted)
return status;
if (status == PermissionStatus.Denied && DeviceInfo.Platform == DevicePlatform.iOS)
return status; // iOS won't show dialog again
if (Permissions.ShouldShowRationale<T>())
{
await Shell.Current.DisplayAlert("Permission needed",
"This feature requires the requested permission.", "OK");
}
return await Permissions.RequestAsync<T>();
}Checklist
- [ ]
CheckStatusAsynccalled before everyRequestAsync - [ ] No permission calls in constructors — use
OnAppearingor commands - [ ] All
PermissionStatusvalues handled (Denied,Restricted,Limited) - [ ] Android:
ShouldShowRationaleshown before re-requesting - [ ] iOS: Settings navigation provided for denied permissions
- [ ] Android API 33+: using
Photos/Mediainstead ofStorageRead/StorageWrite - [ ] Manifest/plist declarations match runtime permission requests
Permissions API Reference
Core API
using Microsoft.Maui.ApplicationModel;
// Check current status
PermissionStatus status = await Permissions.CheckStatusAsync<Permissions.Camera>();
// Request permission
status = await Permissions.RequestAsync<Permissions.Camera>();
// Android: check if rationale should be shown after prior denial
bool showRationale = Permissions.ShouldShowRationale<Permissions.Camera>();PermissionStatus Enum
| Value | Meaning |
|---|---|
Unknown | Status unknown or not supported on platform |
Denied | User denied the permission |
Disabled | Feature is disabled on the device |
Granted | User granted permission |
Restricted | Permission restricted by policy (iOS parental, etc.) |
Limited | Partial access granted (iOS limited photo access) |
Available Permissions
Battery, Bluetooth, CalendarRead, CalendarWrite, Camera, ContactsRead, ContactsWrite, Flashlight, LocationWhenInUse, LocationAlways, Media, Microphone, NearbyWifiDevices, NetworkState, Phone, Photos, PhotosAddOnly, PhotosReadWrite, PostNotifications, Reminders, Sensors, Sms, Speech, StorageRead, StorageWrite, Vibrate
Access via Permissions.<Name>, e.g. Permissions.CheckStatusAsync<Permissions.LocationWhenInUse>().
Custom Permissions
Extend BasePlatformPermission and override platform-specific required permissions:
public class ReadExternalStoragePermission : Permissions.BasePlatformPermission
{
#if ANDROID
public override (string androidPermission, bool isRuntime)[] RequiredPermissions =>
new (string, bool)[]
{
("android.permission.READ_EXTERNAL_STORAGE", true)
};
#endif
}
// Usage
var status = await Permissions.RequestAsync<ReadExternalStoragePermission>();Platform Permission Declarations
Android
Declare permissions in Platforms/Android/AndroidManifest.xml:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />iOS
Declare usage descriptions in Platforms/iOS/Info.plist:
<key>NSCameraUsageDescription</key>
<string>This app needs camera access to take photos.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs your location for nearby search.</string>Windows
Most permissions return Granted or Unknown. Declare capabilities in Platforms/Windows/Package.appxmanifest under <Capabilities>.
Mac Catalyst
Follows iOS patterns. Add usage descriptions to Info.plist and entitlements to Entitlements.plist as needed.
DI-Friendly Permission Service
public interface IPermissionService
{
Task<PermissionStatus> CheckAndRequestAsync<T>() where T : Permissions.BasePermission, new();
}
public class PermissionService : IPermissionService
{
public async Task<PermissionStatus> CheckAndRequestAsync<T>() where T : Permissions.BasePermission, new()
{
var status = await Permissions.CheckStatusAsync<T>();
if (status == PermissionStatus.Granted)
return status;
if (Permissions.ShouldShowRationale<T>())
{
await Shell.Current.DisplayAlert("Permission required",
"Please grant the requested permission to use this feature.", "OK");
}
return await Permissions.RequestAsync<T>();
}
}
// Registration
builder.Services.AddSingleton<IPermissionService, PermissionService>();