Access & Permissions
Every Shiny module reports permissions through a single enum, Shiny.AccessState. That means the same handling code works whether RequestAccess() came from GPS, BLE, notifications, or push.
| Value | Meaning | What to do |
|---|---|---|
Unknown |
Not checked yet, or the OS is in an unknown state. On Android, it also means the permission has never been requested | Request access |
NotSupported |
The device or platform cannot do this at all | Hide the feature |
NotSetup |
Something is missing from AndroidManifest.xml, Info.plist, or the appx manifest |
Fix your project. This is a developer error, not a user choice |
Disabled |
The user has turned the service off (e.g. Location Services or Bluetooth) | Ask the user to turn it back on |
Restricted |
Partially granted, e.g. foreground location when background was requested | Carry on with reduced functionality, or explain why you need more |
Denied |
The user refused | Explain, and send them to the app’s settings |
Available |
Everything needed is granted | Proceed |
Asserting
Section titled “Asserting”The Assert extension throws InvalidOperationException unless the state is Available. Pass allowRestricted: true to accept partial access:
var access = await gpsManager.RequestAccess(GpsRequest.Foreground);access.Assert("GPS permission is required to track your run");
var bg = await gpsManager.RequestAccess(GpsRequest.Realtime(true));bg.Assert(allowRestricted: true);PermissionException
Section titled “PermissionException”Modules throw PermissionException(module, badStatus) when they cannot continue, with a message like GPS had status of Denied. Throw it from your own code to follow the same convention.
Declaring Permissions
Section titled “Declaring Permissions”AccessState.NotSetup usually means the manifest is missing an entry. Rather than editing AndroidManifest.xml and Info.plist by hand, MSBuild Permissions generates both from one list in your project file.
For the Android runtime permission APIs underneath all of this, see AndroidPlatform.


