Browse SDKs · Flutter
Platform
SDKsFlutter

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 SDK to synchronize remote push notification badge counters:

Parameters

ParameterTypeRequiredDescription
countintYesTotal unread message count displayed across the application (non-negative integer).

Code example

await OpenIM.iMManager.messageManager.setAppBadge(totalUnreadCount);

Invoke this method when the total unread message count changes, after post-login synchronization completes, or after clearing unread messages in bulk. Never pass a single conversation's unread count as the app-wide badge number.

Return value

Future completion indicates that the SDK successfully accepted and recorded the badge count.

State changes after the call

Calling this method does not modify conversation unread counts stored in the local database. If your application displays badge numbers on the mobile OS app launcher icon, update the platform UI using native APIs or third-party Flutter badge plugins alongside this call. For querying and listening to aggregate unread counts, see Get total unread message count.