OneSignal-Flutter-SDK
OneSignal-Flutter-SDK copied to clipboard
[Feedback]: Add the method to set the app badge count manually.
What's on your mind?
I want to add one function to set the app badge count manually on foreground state.
OneSignal.shared.clearOneSignalNotifications();
This method worked well. Checked this method is putting the app badge count as 0. If possible, please provide the method also to set the custom count for app badge. So when the app is on foreground, I can set the app badge count according to the unread logic. Thanks.
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
@vernalclareai Thanks for the suggestion, however Android only allows setting a badge number in conjunction with showing a notification. See Android's Modify a Notification Badge for the details on this limitation.
Before Android 8 (Oreo) introduced notification badges (also known as notification dots) it was common for device manufactures to add their own badge counts. However I believe most of them (if not all) have dropped theirs in-favor of Android official supported noted above. Let us know however if this is not the case.
okay, I will provide more details with the video recording. @jkasten2
Hi, @jkasten2
Just sharing more details.
iOS version is working well, but Android is always increasing the app badge count from 0 although set the count using the FlutterAppBadger.updateBadgeCount(unreadCount)
iOS Recording :
https://user-images.githubusercontent.com/61595318/209926477-134833a0-a191-46b2-a88b-d80606705c2a.mp4
Android Recording:
https://user-images.githubusercontent.com/61595318/209926617-9978968f-7ce9-4409-86c6-85862036a825.mp4
Can you check the updateBadgeCount func and fix? or suggest to use another func for this case? Thanks.
@vernalclareai Can you show me some code counting badge on ios when run background, my ios show notifications but badge not update. Thanks
Hi, @chiennv23 Badge count will be increased automatically when receiving the push notification.