You can set the app icon badge number with a push notification, either as an exact value or as an increment/decrement of the current value.
In the Control Panel
In the push content editor (Content → Push Presets, or when composing a push), click Notification settings under the preview and set the badge count:
- +1 — increases the current badge by 1;
- -1 — decreases the current badge by 1;
- a number, for example 5 — sets the exact badge value.
See Set badge count.
Via API
In the Messaging API v2, set badges in the platform block, for example "ios": { "badges": "+1" }. In the legacy /createMessage method (deprecated), use "ios_badges" or "android_badges" with an integer (5) or a string ("+1", "-1").
App setup
-
iOS: relative values (+1/-1) are applied only by a Notification Service Extension based on
PushwooshNotificationServiceExtensionwith a shared App Group. Without it, iOS applies the absolute badge value as-is. See Setting up badges (iOS). -
Android: add the
com.pushwoosh:pushwoosh-badgemodule. Badges are shown only on supported launchers. See Using badge number on Android.
Change the badge from the app
To update the badge in response to in-app events, for example to clear it when the user opens the app:
-
iOS: set
UIApplication.shared.applicationIconBadgeNumber. The SDK syncs the value with Pushwoosh automatically;Pushwoosh.configure.sendBadges(_:)syncs it manually if needed. -
Android: use
PushwooshBadge.setBadgeNumber(int)(0clears the badge) orPushwooshBadge.addBadgeNumber(int).
For cross-platform apps, see the badge guides for React Native, Flutter, Cordova, and Unity.
Comments
0 comments
Please sign in to leave a comment.