Skip to content

Commit 3bcccda

Browse files
committed
Add docs section about permission
1 parent bbc00b3 commit 3bcccda

File tree

1 file changed

+14
-0
lines changed
  • com.unity.mobile.notifications/Documentation~

1 file changed

+14
-0
lines changed

com.unity.mobile.notifications/Documentation~/Android.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@ After you create a notification channel, you can't change its behavior. For more
2323

2424
On devices that use Android versions prior to 8.0, this package emulates the same behavior by applying notification channel properties, such as `Importance`, to individual notifications.
2525

26+
## Request permission to post notifications
27+
28+
Starting with Android 13.0 (API level 33) notifications can not be posted without users permission. They can still be scheduled, but will work silently with no UI shown to the user. You can request the permission by running this method in the coroutine:
29+
30+
```c#
31+
IEnumerator RequestNotificationPermission()
32+
{
33+
var request = new PermissionRequest();
34+
while (request.Status == PermissionStatus.RequestPending)
35+
yield return null;
36+
// here use request.Status to determine users response
37+
}
38+
```
39+
2640
## Manage notifications
2741

2842
This package provides a set of APIs to manage notifications. These APIs allow you to perform actions such as sending, updating, and deleting notifications. For more notification-related APIs, see [AndroidNotificationCenter](../api/Unity.Notifications.Android.AndroidNotificationCenter.html).

0 commit comments

Comments
 (0)