Mark a conversation as read
Use messageManager.markConversationMessageAsRead() to mark Android conversation messages as read.
Call messageManager.markConversationMessageAsRead() after the user has opened and read visible messages. Do not mark a conversation read merely because a notification was previewed or a message arrived in the background.
OpenIMClient.getInstance().messageManager.markConversationMessageAsRead(
conversationID,
new OnBase<String>() {
@Override
public void onSuccess(String data) {
markConversationReadSubmitted(conversationID);
}
@Override
public void onError(int code, String error) {
recordMarkReadFailure(code, error);
}
}
);Request completion does not guarantee onConversationChanged has arrived. Merge the current ConversationInfo by conversationID, or re-query it when immediate confirmation is required.
For one-to-one chats, the peer can receive OnAdvanceMsgListener.onRecvC2CReadReceipt. Validate sessionType == ConversationType.SINGLE_CHAT and a non-empty userID, then update message read state from msgIDList. MessageManager retains one advanced message listener and should be configured once in a shared message state layer.
Was this page helpful?