OneSignal-Flutter-SDK icon indicating copy to clipboard operation
OneSignal-Flutter-SDK copied to clipboard

[Feedback]: Add the method to set the app badge count manually.

Open vernalclareai opened this issue 2 years ago • 5 comments

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 avatar Oct 05 '22 01:10 vernalclareai

@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.

jkasten2 avatar Nov 22 '22 03:11 jkasten2

okay, I will provide more details with the video recording. @jkasten2

vernalclareai avatar Nov 22 '22 04:11 vernalclareai

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 avatar Dec 29 '22 08:12 vernalclareai

@vernalclareai Can you show me some code counting badge on ios when run background, my ios show notifications but badge not update. Thanks

chiennv23 avatar May 11 '23 08:05 chiennv23

Hi, @chiennv23 Badge count will be increased automatically when receiving the push notification.

vernalclareai avatar Aug 01 '23 14:08 vernalclareai