SDKsAndroid
Track the total unread count
Use getTotalUnreadMsgCount() to retrieve the total unread count for the signed-in account.
getTotalUnreadMsgCount() returns the total unread count for the signed-in account.
OpenIMClient.getInstance().conversationManager.getTotalUnreadMsgCount(
new OnBase<String>() {
@Override
public void onSuccess(String value) {
int totalUnread = Integer.parseInt(value);
// totalUnread is the account's total unread count.
}
@Override
public void onError(int code, String error) {
// code and error describe the failure.
}
}
);The callback value is a String and can be parsed for display. When the total unread count changes, receive the update through OnConversationListener.onTotalUnreadMessageCountChanged(int count); see Get the conversation list for listener setup.
Was this page helpful?