Badge Count
You can set badge count that shows the current number of unread notifications. The badge will appear on top right of the app icon on iOS. On Android it needs to be supported by OEMs. You can read more about badge counts on OneSignal website
You can set the badge count manually using the following Median JavaScript badge function
↔️Median JavaScript Bridge
median.onesignal.badge.set(2); // this removes the badge median.onesignal.badge.set(0);
Legacy Support
This method is not available on the legacy OneSignal plugin. To learn more about it see Legacy Mode
Frequently Asked Questions
How do I clear the push notification badge count on iOS?
App Groups capability is required for OneSignal to communicate with your app for clearing push notification badge count. You must add the App Groups capability to Main App Target and OneSignalNotificationServiceExtension Target.
For both Targets, set the App Groups container to be group.YOUR_BUNDLE_IDENTIFIER.onesignal
where YOUR_BUNDLE_IDENTIFIER
is the same as your Main Application "Bundle Identifier".
Detailed steps with screenshots are available on OneSignal's website at https://documentation.onesignal.com/docs/ios-sdk-setup#3-add-app-groups.
Updated 5 days ago