Skip to content

Commit 7b946b6

Browse files
Document iOS/Mac Catalyst PostNotifications permission support (.NET 11) (#3280)
Update the permissions article to reflect that Permissions.PostNotifications is now supported on iOS and Mac Catalyst, added in .NET 11 Preview 3 (dotnet/maui#30132). Changes include: - Update platform support table: PostNotifications iOS column ❌ → ✔️ - Add moniker-gated note explaining the new Apple platform support - Add code example for requesting notification permissions - Note that iOS uses UNUserNotificationCenter.RequestAuthorization and does not require an Info.plist usage description string Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 5d8a0c4 commit 7b946b6

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

docs/platform-integration/appmodel/permissions.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Permissions"
33
description: "Learn how to use the .NET MAUI Permissions class, to check and request permissions. This class is in the Microsoft.Maui.ApplicationModel namespace."
4-
ms.date: 10/28/2024
4+
ms.date: 07/11/2025
55
no-loc: ["Microsoft.Maui", "Microsoft.Maui.ApplicationModel"]
66
---
77

@@ -36,7 +36,7 @@ The following table uses ✔️ to indicate that the permission is supported and
3636
| [Phone](xref:Microsoft.Maui.ApplicationModel.Permissions.Phone) | ✔️ | ✔️ |||
3737
| [Photos](xref:Microsoft.Maui.ApplicationModel.Permissions.Photos) || ✔️ || ✔️ |
3838
| [PhotosAddOnly](xref:Microsoft.Maui.ApplicationModel.Permissions.PhotosAddOnly) || ✔️ || ✔️ |
39-
| [PostNotifications](xref:Microsoft.Maui.ApplicationModel.Permissions.PostNotifications) | ✔️ | |||
39+
| [PostNotifications](xref:Microsoft.Maui.ApplicationModel.Permissions.PostNotifications) | ✔️ | ✔️ |||
4040
| [Reminders](xref:Microsoft.Maui.ApplicationModel.Permissions.Reminders) || ✔️ |||
4141
| [Sensors](xref:Microsoft.Maui.ApplicationModel.Permissions.Sensors) | ✔️ | ✔️ |||
4242
| [Sms](xref:Microsoft.Maui.ApplicationModel.Permissions.Sms) | ✔️ | ✔️ |||
@@ -50,6 +50,13 @@ The following table uses ✔️ to indicate that the permission is supported and
5050
5151
If a permission is marked as ❌, it will always return <xref:Microsoft.Maui.ApplicationModel.PermissionStatus.Granted> when checked or requested.
5252

53+
:::moniker range=">=net-maui-11.0"
54+
55+
> [!NOTE]
56+
> Starting with .NET MAUI in .NET 11, `PostNotifications` is also supported on iOS and Mac Catalyst. On Apple platforms, this permission uses `UNUserNotificationCenter.RequestAuthorization` to request notification authorization from the user. Unlike most iOS permissions, `PostNotifications` does not require an `Info.plist` usage description string.
57+
58+
:::moniker-end
59+
5360
## Checking permissions
5461

5562
To check the current status of a permission, use the <xref:Microsoft.Maui.ApplicationModel.Permissions.CheckStatusAsync%2A?displayProperty=nameWithType> method along with the specific permission to get the status for. The following example checks the status of the [`LocationWhenInUse`](xref:Microsoft.Maui.ApplicationModel.Permissions.LocationWhenInUse) permission:
@@ -95,6 +102,20 @@ A <xref:Microsoft.Maui.ApplicationModel.PermissionException> is thrown if the re
95102
> [!IMPORTANT]
96103
> On some platforms, a permission request can only be activated a single time. Further prompts must be handled by the developer to check if a permission is in the <xref:Microsoft.Maui.ApplicationModel.PermissionStatus.Denied> state, and then ask the user to manually turn it on.
97104
105+
:::moniker range=">=net-maui-11.0"
106+
107+
### Requesting notification permissions
108+
109+
To request notification posting permissions on Android, iOS, and Mac Catalyst, use the [`PostNotifications`](xref:Microsoft.Maui.ApplicationModel.Permissions.PostNotifications) permission:
110+
111+
```csharp
112+
var status = await Permissions.RequestAsync<Permissions.PostNotifications>();
113+
```
114+
115+
On Android, this maps to the `POST_NOTIFICATIONS` manifest permission. On iOS and Mac Catalyst, this uses `UNUserNotificationCenter.RequestAuthorization` to request notification authorization from the user. If the user has previously denied the notification permission on iOS, the method returns <xref:Microsoft.Maui.ApplicationModel.PermissionStatus.Denied> and the user must enable notifications manually through the Settings app.
116+
117+
:::moniker-end
118+
98119
## Explain why permission is needed
99120

100121
It's best practice to explain to your user why your application needs a specific permission. On iOS, you must specify a string that is displayed to the user. Android doesn't have this ability, and also defaults permission status to <xref:Microsoft.Maui.ApplicationModel.PermissionStatus.Disabled>. This limits the ability to know if the user denied the permission or if it's the first time the permission is being requested. The <xref:Microsoft.Maui.ApplicationModel.Permissions.ShouldShowRationale%2A> method can be used to determine if an informative UI should be displayed. If the method returns `true`, this is because the user has denied or disabled the permission in the past. Other platforms always return `false` when calling this method.

0 commit comments

Comments
 (0)