Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notification badge count not clearing #388

Open
stib opened this issue Jun 25, 2024 · 2 comments
Open

Notification badge count not clearing #388

stib opened this issue Jun 25, 2024 · 2 comments

Comments

@stib
Copy link

stib commented Jun 25, 2024

Hello,

I am using shortcutBadger through the @capawesome/capacitor-badge plugin. I posted this issue in the @CAPawesome plugins project but was advised by the @capawesome/capacitor-badge author Robin to post the issue here. I am hoping someone is still looking at these questions here and can help address this issue.

Badge setting and clearing work fine on iOS but on Android the Badge clear does not clear the badge count coming from push notification. So if I have a App badge count of say 3 from push notifications that have come in, calling badge clear doesn't have any effect. If I set badge count to 5 through Badge.set then App badge will change to 5 and when that gets cleared through Badge.clear, the App badge count goes back to push notification count of 3. It seems like they are two different counts that the system maintains and the Badge.clear does not have any impact on the notification count for Android.

Here are more details -

  1. I am on Samsung Galaxy S22, Android version 13. Using @capawesome/capacitor-badge version 5.0.0
  2. Send push notification - App badge count goes to 1. Sending more will increment that count
  3. When App goes in background, catch that event and call Badge.clear
  4. The push notification count does not change.
  5. Open the App again and Set badge count to say 5 with Badge.set
  6. Badge count goes from 1 to 5
  7. When App goes in background again (as in 3) catch the event and call Badge.clear
  8. The badge count goes back to 1 or 2 or 3, the number for push notifications that have come in

The system seems to keep two different counts - one for the push notifications coming in and one that is set through Badge.set

Appreciate any thoughts/guidance on how to resolve this in clearing the count for push notifications as well.

Thanks,
Sanjay.

@boblepepeur
Copy link

Same here

@namnguyendjv
Copy link

Through observation, ShortcutBadger.applyCount(0) will lead Android system to use number of push notifications as app badge (which is og behavior). If you want to completely remove app badge, then you should call NotificationManager.cancelAll() to clear all notification before, then ShortcutBadger.applyCount(0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants