Push notification badge display

RC doesn’t manage app badge numbers, and the RC SDK doesn’t control badge display. This guide covers badge control for vendor push notifications.

Many developers want to enable badges or red dots on the app icon for better reminders. Support varies by vendor:

Vendor Badge/red dot support Configuration needed Notes
Huawei Badge Yes See Huawei push badge guide.
Honor Badge Yes See Honor push badge guide.
Xiaomi Badge No Follows system logic. Xiaomi MIUI 6+ devices support numeric badges, handled automatically. Notifications increment/decrement by 1, reset when the app opens.
OPPO Red dot No Red dot requires manual activation in settings. Numeric display is limited to apps like QQ and WeChat, needing official approval. No clear guide available.
vivo Not supported - RC only supports vivo notification bar messages, which don’t display badges.
Meizu Red dot No Follows system logic, only supports red dots (shows with notifications, hides otherwise).
iOS Badge No Client messages don’t control badges. Server API for one-to-one chat or direct remote push supports badge numbers.

Huawei push badge guide

Limitations

Huawei badge display works on EMUI 8.0+ devices. Badge functionality varies by push type:

Push type Huawei badge support RC support
Notification bar message Supports auto-increment by x or direct setting. Auto-decrement by 1 on notification click, but not on clear. Supports auto-increment by x. Direct setting isn’t supported. Configure badgeAddNum (Huawei’s add_num) in the developer console. Huawei’s set_num isn’t supported.
Transparent message (deprecated) Developers handle setting and increment/decrement logic. RC doesn’t support Huawei push via transparent messages (deprecated, legacy customers can call HMS SDK APIs directly).

Setup

Developer console

Go to the RC developer console, navigate to app identifier, click Set push, find Android > Huawei push, and edit the app entry activity class. It must be the app entry activity class; otherwise, badges won’t display.

Set badgeAddNum to accumulate badge numbers. For example, if badgeAddNum is 1 and the original badge number is 2, the app badge will show 3 after sending a message.

Badge permission

Add badge read/write permission in the app’s AndroidManifest.xml file:

<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE"/>  

Auto-increment/decrement

Huawei devices support auto-increment/decrement by 1 (negative number for decrement, positive for increment). Implement this in the client code:

Bundle extra = new Bundle();  
extra.putString("package", "xxxxxx");  
extra.putString("class", "yyyyyyy");  
extra.putInt("badgenumber", i);  
context.getContentResolver().call(Uri.parse("content://com.huawei.android.launcher.settings/badge/"), "change_badge", null, extra);  

Clear badge

Opening the app or clearing notifications won’t clear the badge. Developers must manually clear it. See the desktop badge guide for details.

Honor push badge guide

Setup

Developer console

Go to the RC developer console, navigate to app identifier, click Set push, find Android > Honor push, and edit the app entry activity class. It must be the app entry activity class; otherwise, badges won’t display.

Set badgeAddNum to accumulate badge numbers. For example, if badgeAddNum is 1 and the original badge number is 2, the app badge will show 3 after sending a message.

Clear badge

Opening the app or clearing notifications won’t clear the badge. Developers must manually clear it.

boolean mIsSupportedBadge = true;  
public void setBadgeNum(int num) {  
    try {  
        Bundle bundle = new Bundle();  
        bundle.putString("package", "cn.rongcloud.im");  
        bundle.putString("class", "cn.rongcloud.im.ui.activity.SplashActivity");  
        bundle.putInt("badgenumber", num);  
        this.getContentResolver().call(Uri.parse("content://com.hihonor.android.launcher.settings/badge/"), "change_badge", null, bundle);  
    } catch (Exception e) {  
        mIsSupportedBadge = false;  
    }  
}  

int num = 0;  
//Application  
public void onCreate() {  
if (mIsSupportedBadge) {  
    setBadgeNum(num);  
}  
}  

iOS badge

Developer console

RC supports configuring iOS to hide badge numbers. Go to the Chat settings, click Push setting, find your project, and click Set push. If not created, click Add.

Server API

Clear badge

When clicking a notification, call the native setApplicationIconBadgeNumber interface to clear the local badge value.

- (void)applicationWillEnterForeground:(UIApplication *)application {  
  [application setApplicationIconBadgeNumber:0];  
  [application cancelAllLocalNotifications];  
}