Unity-Technologies / com.unity.mobile.notifications

Mobile Notifications Package
https://docs.unity3d.com/Packages/com.unity.mobile.notifications@2.1/manual/index.html
Other
131 stars 42 forks source link

Android: report if notifications are enabled #264

Closed aurimasc closed 1 year ago

aurimasc commented 1 year ago

https://jira.unity3d.com/browse/MNB-43 On Android 7+ notifications can be disabled per app. Right now we have AndroidNotificationCenter.UserPermissionToPost, but it only report if permission is enabled, which is Android 13+. This PR adds one more enum value for disabled notifications and reports that on Android 7+. On even older Android versions it should be always enabled. Note: looks like there is no such thing as disabled notifications in Android 13, it simply revokes the permission.

The Main test project prints permission status each time when gaining focus and there is a button to open settings. Please do try Android version <7 if nothing bad happens!