Browse SDKs · Android
Platform
SDKsAndroidEnterprise

Report group messages as read

Report group-message read receipts with the Android SDK.

Copy

Report read receipts for group messages that the current user has viewed. As the conversation timeline scrolls or messages enter the visible viewport, pass the list of visible client message IDs to the server. This allows group message senders to track read and unread member counts in real time.

Code example

String conversationID = "g_group_123";
List<String> visibleClientMsgIDs = Arrays.asList("msg_001", "msg_002");

OpenIMClient.getInstance().messageManager.sendGroupMessageReadReceipt(
    conversationID,
    visibleClientMsgIDs,
    new OnBase<String>() {
        @Override
        public void onSuccess(String data) {
            // Read receipts reported successfully
        }

        @Override
        public void onError(int code, String error) {
            // Handle reporting failure
        }
    }
);

Parameters

ParameterTypeRequiredDescription
conversationIDStringYesGlobally unique ID of the target group conversation.
clientMsgIDsList<String>YesList of client message IDs in the visible viewport to mark as read. All messages must belong to the specified conversation.
baseOnBase<String>YesCallback handler for the asynchronous request.

Return value

Upon success, data in onSuccess returns a confirmation message.

State changes after the call

  1. Callback confirmation: The onSuccess callback indicates that the server accepted the read receipts.
  2. Asynchronous event delivery: Group message senders and participants receive incremental read receipt events through OnAdvanceMsgListener.onRecvGroupMessageReadReceipt:
@Override
public void onRecvGroupMessageReadReceipt(GroupMessageReceipt receipt) {
    // Update read count and read status for messages matched by clientMsgID
}
  1. Aggregate unread count separation: Group message read receipts update message-level reader counts. To clear the aggregate unread badge count for the conversation locally and on the server, call Mark a conversation as read.
  2. Member detail query: To view the full list of members who have or have not read a specific group message, see Get members who read a group message.

For complete listener registration and lifecycle management, see Receive messages.