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

Notification permission request can be done twice #248

Closed IgorGalimski closed 1 year ago

IgorGalimski commented 1 year ago

Hi We use mobile notification package 2.1.1 and notified that the permission popup can be shown the second time if the first time if was declined. Please, checkout the video. I use google pixel 6a with the latest android 13, android target SDK is 33

Is it a bug in android?

https://user-images.githubusercontent.com/19680568/213463166-29cefce8-404b-4ea4-98cc-7bab67a828d5.mp4

IgorGalimski commented 1 year ago

Requesting the permission 2 times - android feature, not a bug https://developer.android.com/training/permissions/requesting#explain https://developer.android.com/develop/ui/views/notifications/notification-permission#wait-to-show-prompt

But actually mobile notifications plugins doesn't check for Would be great to have a bool property - if the first time popup was declined. Also, it will be possible to get rid of saved status. Now we detect for the permission status like this:

Screenshot 2023-01-20 at 20 58 15

Other issues: When the popup was shown for the first time User clicked "Don't allow" -> callback PermissionCallbacks.PermissionDenied is invoked User swiped away -> callback PermissionCallbacks.PermissionDeniedAndDontAskAgain

User denied the popup. The popup was shown the second time: Users clicked "Don't allow" -> callback PermissionCallbacks.PermissionDeniedAndDontAskAgain User swiped away -> callback PermissionCallbacks.PermissionDenied is invoked

So, the callbacks change the order after the fist deny, and it looks like a bug

Also, if I don't subscribe to PermissionDenied and PermissionDeniedAndDontAskAgain callbacks, and use only PermissionDenied - it gets invoked in both case of actual swipe away and pressing "Don't allow" which is not obvious

So, now when we need to hook for the callbacks and have our own logic - we can't really do it, because they are messed Is it possible to have wrappers over these engine's callbacks? To have 3 specific callbacks like:

IgorGalimski commented 1 year ago

Up

aurimasc commented 1 year ago

That's not exactly how it work. We'll do an update to API for it.

aurimasc commented 1 year ago

Added new API to check, if permission rationale should be explained.