Set conversation message reception
Configure message reception and offline notification behavior for a specific conversation.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
base | OnBase<String> | Yes | Callback delivering the asynchronous operation result. |
conversationID | String | Yes | Target conversation identifier. |
opt | int | Yes | Message reception mode integer code. |
Message reception modes
| Enum constant | Value | Description |
|---|---|---|
ReceiveMessageOpt.Normal | 0 | Receive messages normally with local alerts and offline push notifications. |
ReceiveMessageOpt.NotReceive | 1 | Reject incoming messages for this conversation entirely without notifications. |
ReceiveMessageOpt.NotNotify | 2 | Receive 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.
Was this page helpful?