Browse SDKs · React Native
Platform
SDKsReact Native

Set the app badge count

Synchronize the app's current unread count with the OpenIMClientSDK push badge state.

Copy

Use setAppBadge() to report the total unread message count currently shown by the app to the SDK.

await OpenIMSDK.setAppBadge(totalUnreadCount);

totalUnreadCount should be a non-negative integer. Update it when the total unread count changes, after login synchronization, or after clearing unread messages. Do not use the unread count of a single conversation as the app-wide badge count.

A resolved Promise only means that the SDK accepted the badge value; it does not change the local unread count of any conversation. If the app displays a launcher icon badge, update the native UI through the appropriate React Native notification integration as well. See Track the total unread count for querying and tracking the count.