Mark a conversation as read
Mark all unread messages in a conversation as read and reset the conversation unread count.
Mark all unread messages within a conversation as read when the user opens the chat screen and views incoming messages. Call this method after the messages are rendered on screen; avoid triggering it prematurely from background notifications or transient popups.
Code example
OpenIMClient.getInstance().messageManager.markConversationMessageAsRead(
conversationID,
new OnBase<String>() {
@Override
public void onSuccess(String data) {
// Read receipt reported successfully.
}
@Override
public void onError(int code, String error) {
// code and error describe the failure.
}
}
);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | String | Yes | Target conversation identifier. |
base | OnBase<String> | Yes | Callback delivering the asynchronous operation result. |
Return value
The successful callback indicates that the server recorded the read receipt. The conversation unread count resets to zero locally, and the overall unread counter decrements accordingly.
State changes after the call
Once the call succeeds, the SDK dispatches the OnConversationListener.onConversationChanged event. Locate the conversation by conversationID and clear its unread badge. For complete listener registration details, see Get the conversation list.
In direct chats, the peer receives a C2C read receipt event via OnAdvanceMsgListener.onRecvC2CReadReceipt. For complete message event details, see Receive messages and Message overview.
Was this page helpful?