Browse SDKs · Android
Platform
SDKsAndroid

Set conversation message reception

Configure message reception and offline notification behavior for a specific conversation.

Copy

Configure message reception and do-not-disturb (DND) modes for a specific conversation, such as standard alerts, silent reception without push alerts, or blocking messages entirely.

Code example

OpenIMClient.getInstance().conversationManager.setConversationRecvMessageOpt(
    new OnBase<String>() {
        @Override
        public void onSuccess(String data) {
            // Reception option updated.
        }

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

Parameters

ParameterTypeRequiredDescription
baseOnBase<String>YesCallback delivering the asynchronous operation result.
conversationIDStringYesTarget conversation identifier.
optintYesMessage reception mode integer code.

Message reception modes

Enum constantValueDescription
ReceiveMessageOpt.Normal0Receive messages normally with local alerts and offline push notifications.
ReceiveMessageOpt.NotReceive1Reject incoming messages for this conversation entirely without notifications.
ReceiveMessageOpt.NotNotify2Receive messages and display them in the chat list, but suppress sound, badge alerts, and offline push notifications (Do Not Disturb).

Return value

The successful callback indicates that the server recorded the updated reception option. The setting synchronizes across all active sessions belonging to the user.

State changes after the call

Once the option takes effect, the SDK triggers the OnConversationListener.onConversationChanged event. When your listener receives this event, locate the conversation by conversationID, update its recvMsgOpt property, and adjust DND indicator icons in the UI. For complete listener registration details, see Get the conversation list. To configure account-wide notification preferences, see Set global message reception.