Unity-Technologies / com.unity.mobile.notifications

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

CancelNotification waits untill all notifications are scheduled before returning #303

Closed abogarsukov-braingames closed 11 months ago

abogarsukov-braingames commented 11 months ago

Hello,

We schedule a lot of notifications in our app (300+). This works fine for us as the actual job is handled on a background thread. One thing that seems odd is CancelNotification implementation. If notifications thread is not completed at the time of the call, it waits for it holding the caller thread (which is main). We observe 5-10 second locks on modern devices because of this.

I believe it should add the task into some kind of a queue in this case and return instantly.

Platform: iOS/Android Package version: 2.2.2 Unity version: 2021.3.28

aurimasc commented 11 months ago

Cancelling notification does queue an operation as well: https://github.com/Unity-Technologies/com.unity.mobile.notifications/blob/0a9409942a2e3d6ea27e9009caccdfbc635dfc58/com.unity.mobile.notifications/Runtime/Android/Plugins/com/unity/androidnotifications/UnityNotificationManager.java#L663

If you feel it's a bug in notifications package, please submit a bug using Unity Editor with a repro project for us to investigate.