Badges
Notification badges that show on app icons.
Badges generally refer to the little numbered dots that show up on your mobile app icon and are meant to let the user know that there are unread notifications for the app.
Web Push Badges are the small icon shown on Android web notifications and can be customized.
iOS Badges
Setting up the App Groups Feature feature is mandatory to customize the badges for your iOS app.
You can use our setBadgeCount
method to customize how the badge count is displayed for your app. By default, it is set to increment by 1 every time a new notification is received.
This can be modified to a static number by using the below method:
func applicationDidBecomeActive(_ application: UIApplication) {
application.applicationIconBadgeNumber = 0
iZooto.setBadgeCount(badgeNumber: 1)
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
[iZooto setBadgeCountWithBadgeNumber:1];
application.applicationIconBadgeNumber = 0;
}
If your project is built using SWIFT, you will have to make some additional changes in the SceneDelegate.swift
file as below:
@available(iOS 13.0, *)
func sceneDidBecomeActive(_ scene: UIScene) {
UIApplication.shared.applicationIconBadgeNumber = 0
iZooto.setBadgeCount(badgeNumber: 1)
}
@available(iOS 13.0, *)
func sceneWillEnterForeground(_ scene: UIScene) {
UIApplication.shared.applicationIconBadgeNumber = 0
iZooto.setBadgeCount(badgeNumber: 1)
}
Pass 0 in the
setBadgeCount
method to default to an incremental value.
Please see Native iOS Badge Handling Methods to manually update badges.
iOS Badges Troubleshooting
If you are seeing incorrect badge counts, refer to our iOS SDK App Groups Setup to make sure this is set up correctly. For further troubleshooting, please see iOS App Group Troubleshooting.
Updated over 1 year ago