I'm not sure it's the right place to ask because I don't have a specific problem with my code (yet)
But I don't understand something basic about the notification badge count, regarding push notifications (on Android):
I saw this library for example:
react-native-shortcutbadger
and in order to change the badge count we can use:
ShortcutBadger.applyCount(count);
But this should be done on the receiver side? Or when the notification is being sent?
What I don't get is that the receiver can have their app shut down, so how will the badge count take place?
On iOS for example you can assign the badge count while sending the notification payload.
Thanks in advance
Related
I am working on android application on which I need to show count on app icon when ever I receive value from api. I am able to update badge value on app icon through notification, but I am unable to update badge count on app icon without notification.
so my question is, do we always need a notification to update count on app icon?
I checked what's app and found that the count on app icon increased through notification but they have clearly mention on their site that Badge count is a notification functionality provided by your launcher and is not a function of WhatsApp. If you continue to experience issues, please contact your phone's manufacturer.
so again my question is how the count is getting decreased after reading the message, suppose the count is 59 and after reading one message count goes to 58?
Yes. We can do it.
By default, you can create a onGoing Notification builder and notify with priority is LOW, and at the same time, you display by ShortcutBadger.
Make sure the notification is silent mode.
Actually the thing I want to achieve is, normally the shortcut icon badge count in android got cleared once the push notification popup is acknowledged by an user from notification panel, but instead clearing the count as above it has to be cleared only after the corresponding notification is acknowledged by an user within the app(for eg: if an user received a text message then the badge count will increased to one and once the user cleared the push notification popup form notification panel then the badge will also got cleared, but instead of that badge should be cleared only after the user viewed the message).
I tried the following packages.
https://www.npmjs.com/package/react-native-app-badge
https://www.npmjs.com/package/react-native-android-badge
Looks like you can use ShortcutBadge.setCount(0); to clear the badge counter!
I dont know what you use to display a notification on the android device itself, probably react-native-push-notification.
If that's the case, they also have a function for it:
PushNotification.setApplicationIconBadgeNumber(0)
You just need to run one of these functions when the event of a dismissed notification triggers, which may or may not need some java coding for achieve it!
I am having a problem while I am open app on another screen the push notification of sendbird is not sent , I need to update the message count of my messages in sendbird , how can I do that ?
Please Check point 4 in this link answer in sendBird help center the question Why am I not receiving push notifications?
.
It says :
A user must be offline - they must be disconnected from ALL devices.
So when the app in the foreground that mean the sendBird user is online and the way they implement it that they don't send notification for the online users which is disappointing to know.
I agree with #Nawaf. I should add if it works for anyone:
Keep unread message count as 1 or coloured dot on your notification badge inside app, when you get SendBird notification on your launcher activity intent. Hide the dot when user clicks the badge.
I want to count notification when received before make Shortcut Badge on my app icon. Now, I can make Shortcut Badge and create php file for send notification from Server sucessful.
But I have a problem I can't count notification for show number by Shortcut Badge.
I will try NotificationListenerService or StatusBarNotification
but I don't know where to call file and work flow.
Help me please.
This is my workflow
I want to add the count of unread notification at my app icon
I tried this link but this was not helpful
Take a look this might work and can make your Android App showing the count of unread messages as a badge on your App shortcut
shorcutBadger