logo
In-app Chat
SDK Error Codes
On this page

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 notifications for specified conversations.
ZIM
    .getInstance()
    .setConversationNotificationStatus(
        ZIMConversationNotificationStatus.doNotDisturb,
        'conversationID',
        ZIMConversationType.group)
    .then((value) {})
    .catchError((onError) {});

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
ZIMEventHandler.onConversationChanged = (ZIM zim, List<ZIMConversationChangeInfo> conversationChangeInfoList){
    // conversationChangeInfoList[0].conversation.notificationStatus 
};

// 2. Query the conversation list
ZIMConversationQueryConfig config = ZIMConversationQueryConfig();
config.count = 10;
config.nextConversation = null;
ZIM
    .getInstance()
    !.queryConversationList(config)
    .then((res) => {
      // res.conversationList[0].notificationStatus
    })
    .catchError((onError) {});

Previous

Manage unread message counts

Next

Delete conversation

On this page

Back to top