Browse SDKs · Android
SDKsAndroid

Mark a conversation as read

Use messageManager.markConversationMessageAsRead() to mark conversation messages as read.

Copy

After the user has opened and read visible messages, call messageManager.markConversationMessageAsRead() to mark the conversation as read. 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) {
            // The request completed.
        }

        @Override
        public void onError(int code, String error) {
            // code and error describe the failure.
        }
    }
);

The callback indicates that the mark-as-read request has completed. To update the conversation list, query conversations again or receive changes through onConversationChanged.

For one-to-one chats, listen for read receipts from the peer through OnAdvanceMsgListener.onRecvC2CReadReceipt. See Receive messages for the message listener setup and Message overview for message callbacks and read-receipt fields.