Android
Supported Vendors
Huawei.
Configuration Method
To configure the Huawei badge parameters in the console, set them to the application's startup class, for example, "com.tencent.qcloud.tim.demo.SplashActivity". The component will automatically parse and update the badge; otherwise, it will not update the badge.
iOS
By default, when the App goes into the background, the IMSDK will set the total number of unread IM messages as the badge. If the App is integrated with offline push, when a new offline push notification is received, the App badge will increment by 1 based on the baseline badge (default is the total number of unread IM messages, or the custom-defined badge if one has been set).
Configuration Method
If you want to customize the badge, follow these steps:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[V2TIMManager.sharedInstance setAPNSListener:self];
[[V2TIMManager sharedInstance] setConversationListener:self];
return YES;
}
- (void)onTotalUnreadMessageCountChanged:(UInt64)totalUnreadCount {
self.unreadNumber = totalUnreadCount;
}
- (uint32_t)onSetAPPUnreadCount {
uint32_t customBadgeNumber = ...
customBadgeNumber += self.unreadNumber;
return customBadgeNumber;
}
Flutter
For configuration, please refer to the iOS and Android sections below. The methods called are also available in the Flutter version of the IM SDK, with the same names.
Was this page helpful?