Browse SDKs · Flutter
Platform
SDKsFlutter

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 OpenIM.iMManager.messageManager.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 completed Future 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 system UI through the notification or badge plugin for the target platform as well. See Retrieve the total unread count for querying and tracking the count.