getTotalUnreadMessageCount
Introduction
The total amount of unread messages.
You can call the this method to get the total unread count of all conversations.
You don't need to go through the conversation list and add up the unread count of each conversation to get the total unread count.
When the total unread count changes, the SDK will proactively call back onTotalUnreadMessageCountChanged to your app to notify you of the latest unread count.
Parameter details
This API has no parameters
Returned template
V2TimValueCallback<int>
{
code : int
desc : String
data : int //The total amount of unread messages.
}
Return value details
name | type | description |
---|---|---|
code | int | Request result: Error codes. 0 means success. |
desc | String | The description of the error. It will be empty if success. |
data | int | The total amount of unread messages. |
Code example
V2TimValueCallback<int> getTotalUnreadMessageCountRes =
await TencentImSDKPlugin.v2TIMManager
.getConversationManager()
.getTotalUnreadMessageCount();
if (getTotalUnreadMessageCountRes.code == 0) {
int? count = getTotalUnreadMessageCountRes.data;
}