Event Tracking
Add a Thumbnail to Your App Inbox
Control App Badging
Push Messages in the Marketing Cloud Engagement REST API Reference
Transactional Push Messages in the Marketing Cloud Engagement REST API Reference
| Available In | Version |
|---|---|
| MobilePush SDK for iOS | 7.x and newer |
The MobilePush SDK automatically sets the application badge value if inbox messaging is enabled in your SDK configuration. The SDK sets the badge in the following cases:
When a push notification created in Engagement has a badge value enabled, iOS sets the application badge directly.
Neither the SDK nor the application can prevent this badge value from being set via a push notification.
Important
Your application can override the SDK’s default badge setting. After you’ve configured your application to manage badging, the MobilePush SDK no longer updates the badge count based on the unread Inbox messages.
To enable your application to manage badge control, set setApplicationControlsBadging(true) on the PushConfigBuilder during the SDK configuration.
1let pushFeatureConfiguration = PushFeatureConfigBuilder()
2 .setApplicationControlsBadging(false)
3 .build()1let mobilePushConfiguration = PushConfigBuilder(appId: appId)
2 .setAccessToken(accessToken)
3 .setApplicationControlsBadging(true)
4 .build()1let builder = MarketingCloudSDKConfigBuilder()
2 .sfmc_setApplicationId(appID)
3 .sfmc_setAccessToken(accessToken)
4 .sfmc_setApplicationControlsBadging(true)
5 .sfmc_build()!If your application manages badging, we recommend updating or resetting the badge value in response to changes in events or data within your app.
You can adjust the badge value by setting it to an integer value.
1// example: set the badge to a user’s "points"
2application.applicationIconBadgeNumber = user.points
3
4// example: clear the badge when app comes to foreground
5func applicationDidBecomeActive(_ application: UIApplication) {
6 application.applicationIconBadgeNumber = 0
7}