Question: We sent a push and incremented the badge. Users report the badge does not disappear when they open the app. Is this expected? Could we send a silent push to decrease the badge instead?
Answer: Yes, this is expected. Pushwoosh sets the badge value that the notification carries; clearing it is the application's job. Reset the badge from your app code when the app is opened:
-
Set an absolute value — set the badge to
0on app open to clear it. -
Change it relatively (Android) — call
PushwooshBadgeto add a negative delta (for example-1) to the existing value.
Keep the badge counter stored on the Pushwoosh side in sync, so subsequent incremental badge pushes are calculated from the correct base. On Android, use the PushwooshBadge API (setBadgeNumber(0) clears the badge and synchronizes it with Pushwoosh automatically). On iOS, the SDK intercepts changes to UIApplication.applicationIconBadgeNumber and syncs them; if you manage the badge in another way, call Pushwoosh.configure.sendBadges(_:) with the current value.
Platform references:
- iOS: PushwooshFramework SDK reference; see also [iOS] Updating iOS app icon badge via Silent Push Notifications.
- Android: Android SDK documentation; note that app-icon badges on Android are launcher-dependent — see [Android] Badges: Challenges and Limitations.
Sending a silent push to decrement the badge does work, but be aware of the side effect: it also decrements the badge for users who never opened the app and still have unread messages, so their counter will drift away from reality. Clearing the badge on app open is the reliable approach.
Comments
0 comments
Please sign in to leave a comment.