Back to all

Resetting badge count in Onesignal

We're incrementing the badge count via Onesignal's REST API and we want to reset the badge count to zero programatically from the app. The badge disappears on the device but the counter resumes from where it was next time a notification is received.

We've added the following to the .plist file manually since we don't have access to a Mac:

<key>CFBundleIdentifier</key>
<string>co.median.ios.xx</string>
<key>OneSignal_app_groups_key</key>
<string>group.co.median.ios.xx.onesignal</string>

<key>CFBundleIdentifier</key>
<string>co.median.ios.xx.OneSignalNotificationServiceExtension</string>
<key>OneSignal_app_groups_key</key>
<string>group.co.median.ios.xx.onesignal</string>

We've also disabled "Clear Notifications and Badges on Launch".

The Onesignal SDK seems to have more methods related to badges but they're not available through the JavaScript bridge.

Calling median.onesignal.badge.set(0) should reset the counter both locally and in onesignal right?