ShortcutBadger icon indicating copy to clipboard operation
ShortcutBadger copied to clipboard

API 26+ counting starts after first notification

Open hopipo opened this issue 6 years ago • 3 comments

Applying the method: applyCount(Context context, int badgeCount) does not set the badge count while some notification is created firstly.

Use case: Using an application for receiving calls & sms. Missed calls does not increase the badge count number. After first sms (invokes a notification) the badge count number is set. After this sms all the missed calls are reflected in badge counter.

hopipo avatar Sep 18 '18 10:09 hopipo

I noticed that there's 2 behaviours for push notifications on Android :

  • unread count (persisting badge, I'd really like that !)
  • notifications count (only counts notifications in system tray)

For instance, WhatsApp counts the number of conversations containing unread messages and sets the badge accordingly. Whether you start the app and/or dismiss all notifications, the badge stays here and only updates when you read one of those conversations or receive a new message in another one. Slack on the other hand works by counting the number of notifications in the system tray.

Another strange thing I noticed is that you can set a badge number like 42, but it won't appear since this library seems to only allow the notifications count mode. However, if you receive any notification, 42 will be set as the app's badge (not 43...). Right now, you'd expect that any new notification would bump the badge from 42 to 43 and so on since it's counting the notifications in my system tray, right ? Unfortunately it doesn't, you'd have to manually set the badge every time if you already did it once for your Android app I guess.

I am going to keep fooling around to see if it's an issue in my code or not. This could also be an issue with some launchers, but Samsung launchers are supported IIRC, or it could be me that missed something ;) Also, it's worth noting that I'm using this library wrapped in react-native-push-notifications

EDIT: I played with this a little bit more and I noticed something intriguing. When my app receives a push notification when in background or killed state, I update my app badge from Firebase's backgroundMessageHandler. Anyway, I noticed the badge stays displayed and doesn't change when I dismiss a notification, but if I dismiss all of my notifications, the badge disappears...

EDIT 2: just noticed this is quite an old issue, and even though I think this might be linked to my actual problem, I decided to create another issue here just in case

bockc avatar Dec 03 '20 09:12 bockc

I have the same issue any updates about this issue ??

magamal avatar Jun 28 '21 02:06 magamal

please, any updates about this case?

VanessaCarpes avatar Nov 01 '21 23:11 VanessaCarpes