Skip to content

Commit fdd5b6e

Browse files
committed
docs: adding permissions
1 parent 5f84da9 commit fdd5b6e

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed
4.5 KB
Loading

docs/images/cross_red_circle.png

4.3 KB
Loading
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
uid: Plugins.Essentials.MainThread
3+
---
4+
5+
# App Permissions
6+
7+
The Permissions API in Prism.Plugin.Essentials allows you to request and check permissions across Android, iOS, MacCatalyst and WinUI on both .NET MAUI and Uno Platform. As with other API's in Prism.Essentials this is automatically registered when Registering Prism Essentials.
8+
9+
## Getting Started
10+
11+
To use the Permissions Manager you can inject the `IPermissionsManager` into your services or ViewModels.
12+
13+
```cs
14+
public class MyViewModel(IPermissionsManager permissions) : BindableBase
15+
{
16+
}
17+
```
18+
19+
To check the state of a given permission you simply need to pass the permission type to the Permission Manager's Check or Request method like:
20+
21+
```cs
22+
var status = await permissions.CheckStatusAsync<LocationAlways>();
23+
24+
if (status != PermissionStatus.NotSupported && status != PermissionStatus.Granted)
25+
{
26+
status = await permissions.RequestAsync<LocationAlways>();
27+
}
28+
```
29+
30+
A permission status of `NotSupported` may be returned when the underlying platform does not require authorization for a specific permission.
31+
32+
## Supported Permissions
33+
34+
| Permission | Android | iOS | MacCatalyst | WinUI |
35+
|------------|:-------:|:---:|:-----------:|:-----:|
36+
| Battery | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) |
37+
| Bluetooth | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) |
38+
| CalendarRead | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) |
39+
| CalendarWrite | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) |
40+
| Camera | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) |
41+
| ContactsRead | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) |
42+
| ContactsWrite | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) |
43+
| Flashlight | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) |
44+
| LaunchApp | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) |
45+
| LocationAlways | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) |
46+
| LocationWhenInUse | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) |
47+
| Maps | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) |
48+
| Media | ![Not Supported](../../images/cross_red_circle.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) |
49+
| Microphone | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) |
50+
| NearbyWifiDevices | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) |
51+
| NetworkState | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) |
52+
| Phone | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) |
53+
| Photos | ![Not Supported](../../images/cross_red_circle.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) |
54+
| PhotosAddOnly | ![Not Supported](../../images/cross_red_circle.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) |
55+
| PostNotifications | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) |
56+
| Reminders | ![Not Supported](../../images/cross_red_circle.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) |
57+
| Sensors | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) |
58+
| Sms | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) |
59+
| Speech | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) |
60+
| StorageRead | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) |
61+
| StorageWrite | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) |
62+
| Vibrate | ![Supported](../../images/circle_green_checkmark.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) | ![Not Supported](../../images/cross_red_circle.png) |

0 commit comments

Comments
 (0)