Vendor | Support for Display of Badge/Red Dot | Require Configuration | Badge/Red Dot Display Rule |
Huawei/HONOR | Badge | Yes | |
Mi | Badge | No | Compliant with the default system logic. Perceive the number of notifications in the notification bar and automatically increase or decrease the badge number by 1 accordingly. |
Meizu | Red dot | No | Compliant with the default system logic. Supports only red dot display. If there is a notification, a red dot will be displayed, and vice versa. |
OPPO | Red dot | No | Display of red dot needs to be manually enabled in notification settings, which is compliant with the default system logic. If there is a notification, a red dot will be displayed, and vice versa. Display of the notification number is available only to specified applications such as QQ and WeChat and requires permission application. No adaption instructions are provided currently. |
vivo | Badge | Yes |
In the push message body, add the `badge_type` field with the following attributes under `body.message.android`.
Parameter | Type | Parent Item | Required | Default Value | Description |
badge_type | int | android | No | -1 | Notification badge: -2: auto increased by 1 (for Huawei devices only) -1: unchanged (for Huawei and vivo devices only) [0, 100): direct configuration (for Huawei and vivo devices only) |
{"audience_type": "token","expire_time": 3600,"message_type": "notify","message":{"android": {"badge_type": -2,"clearable": 1,"ring": 1,"ring_raw": "xtcallmusic","vibrate": 1,"lights": 1,"action": {"action_type": 1,"activity": "com.qq.xg4all.JumpActivity","aty_attr": {"if": 0,"pf": 0}}},"title": "android test","content": "android test 21"},"token_list": ["01f6ac091755a79015b4a30c9c4c7ddba1ea"],"multi_pkg": true,"platform": "android",}
/*** @param context //Application context* @param setNum //Set the badge number* @since v1.2.0.1*/XGPushConfig.setBadgeNum(Context context, int setNum);
XGPushConfig.setBadgeNum(context, 8)
to set the badge number to 8./*** @param context //Application context* @since v1.2.0.1*/XGPushConfig.resetBadgeNum(Context context);
XGPushConfig.resetBadgeNum(context)
to reset the badge number.Push Form | Badge Capability | Implementation Method |
Notification through the Huawei channel | The badge number can be auto increased by 1, directly configured, or unchanged; can be auto decreased by 1 for notification click; but cannot be auto decreased by 1 for notification dismissal. | Configure in the console or through the push API keyword. |
Notification through the Tencent Push Notification Service channel | The badge number can be auto increased by 1, directly configured, or unchanged; can be auto decreased by 1 for notification click or dismissal. | Configure in the console or through the push API keyword. |
In-app message | You can process the badge number configuration, increase, and decrease logic by yourself. | Call the open API of the Tencent Push Notification Service SDK. |
manifest
tag in the AndroidManifest.xml
file of the application:<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE" /><!-- Compatible on HONOR phones --><uses-permission android:name="com.hihonor.android.launcher.permission.CHANGE_BADGE" />
Activity
class, such as com.test.badge.MainActivity
, of the application entry corresponding to the desktop icon in the parameter configuration area. Otherwise, the badge settings will not take effect. AndroidManifest.xml
file in the package and search for the keywords "android.intent.category.LAUNCHER" in the file. The activity.name
attribute found is the startup class name.
/*** Huawei phone badge modification API** @param context //Application context* @param changeNum //Changed number, which is incremental. For example, if the previous badge number is 5 and this input parameter is 1, the badge number will be set to 6.*Valid values: 1 (badge number increased by 1); -1 (badge number decreased by 1)*/XGPushConfig.changeHuaweiBadgeNum(Context context, int changeNum);
XGPushConfig.changeHuaweiBadgeNum(context, 1)
to increase the badge number by 1; when the message badge needs to be dismissed, call XGPushConfig.changeHuaweiBadgeNum(context, -1)
to decrease the badge number by 1.Push Form | Badge Capability | Implementation Method |
Notification through the vivo channel | Not supported | Not supported |
Notification through the Tencent Push Notification Service channel | The badge number can be directly configured or unchanged, but cannot be auto increased or decreased. | Configure in the console or through the push API keyword. |
In-app message | You can process and configure the logic by yourself. | Call the open API of the Tencent Push Notification Service SDK. |
manifest
tag in the AndroidManifest.xml
file of the application:<uses-permission android:name="com.vivo.notification.permission.BADGE_ICON" />
Was this page helpful?