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

Report the total unread message count currently displayed by the application to the OpenIM SDK to synchronize badge state with remote push notification services:

await OpenIMSDK.setAppBadge(totalUnreadCount);

Parameters

ParameterTypeRequiredDescription
totalUnreadCountnumberYesTotal unread message count currently displayed by the application. Must be a non-negative integer.

Return value

A resolved Promise confirms that the SDK accepted and updated the badge count.

  • This method only synchronizes the total unread count with the SDK and remote push notification services; it does not directly alter the unread status of individual conversations.
  • To display a numeric badge on the mobile home screen icon (iOS launcher badge or Android application icon), combine this API with native React Native badge packages (such as @react-native-community/push-notification-ios or vendor push SDKs) to update system launcher badges.
  • For querying and tracking real-time unread counts, see Get total unread count.