Skip to content


Badges

You can specify the desired badge count when you compose a push notification through the Braze dashboard. You may also update your badge count manually through your application’s applicationIconBadgeNumber property or the remote notification payload. Braze will also clear the badge count when a Braze notification is received while the app is foregrounded.

If you do not have a plan for clearing badges as part of normal app operation or by sending pushes that clear the badge, you should clear the badge when the app becomes active by adding the following code to your app’s applicationDidBecomeActive: delegate method:

1
2
3
4
5
6
7
8
9
10
// For iOS 16.0+
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
[center setBadgeCount:0 withCompletionHandler:^(NSError * _Nullable error) {
    if (error != nil) {
        // Handle errors
    }
}];

// Prior to iOS 16. Deprecated in iOS 17+.
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
1
2
3
4
5
6
7
8
9
10
// For iOS 16.0+
let center = UNUserNotificationCenter.current()
do {
  try await center.setBadgeCount(0)
} catch {
  // Handle errors
}

// Prior to iOS 16. Deprecated in iOS 17+.
UIApplication.shared.applicationIconBadgeNumber = 0

Note that setting the badge number to 0 will also clear up notifications in the notification center. So even if you don’t set badge number in push payloads, you can still set the badge number to 0 to remove the push notification(s) in the notification center after users click on the push.

HOW HELPFUL WAS THIS PAGE?
New Stuff!