Mute a conversation
Introduction
Mute a conversation: A user can mute any conversation, and when the ZIM SDK receives a message for the conversation, it does not send a push notification, and the total count of unread messages does not increase.

Enable for mute a conversation
To mute a conversation, call the setConversationNotificationStatus method with the conversationID
parameter.
// Mute a conversation
// Take a group conversation as example
zim.setConversationNotificationStatus(ZIMConversationNotificationStatus.DO_NOT_DISTURB, "CONV_ID", ZIMConversationType.PEER, new ZIMConversationNotificationStatusSetCallback() {
@Override
public void onConversationNotificationStatusSet(ZIMError errorInfo) {
// Set the callback for the results of mute notifications.
if(errorInfo.code == ZIMErrorCodeSuccess) {
// ......
} else {
// ......
}
}
});
Get a silent conversation state
After setting the mute, the client will receive the onConversationChanged notification event on the operation end and multi-end online devices.Through this event callback, the mute conversation state can be obtained.
After the offline device re-logs in, the mute conversation state can be obtained through the ZIMConversation.notificationStatus
property of the conversation list.
// 1. Listen for conversation change events
public void onConversationChanged(ZIM zim, ArrayList<ZIMConversationChangeInfo> conversationChangeInfoList) {
super.onConversationChanged(zim, conversationChangeInfoList);
// conversationChangeInfoList.get(0).conversation.notificationStatus
}
// 2. Query the conversation list
ZIMConversationQueryConfig config = new ZIMConversationQueryConfig();
config.count = 10;
config.nextConversation = null;
zim.queryConversationList(config, new ZIMConversationListQueriedCallback() {
@Override
public void onConversationListQueried(ArrayList<ZIMConversation> conversationList, ZIMError errorInfo) {
// Get the conversation list query result
if(errorInfo.code == ZIMErrorCode.SUCCESS) {
// conversationList.get(0).notificationStatus
} else {
// ......
}
}
});