logo
In-app Chat
SDK Error Codes
Powered Byspreading
On this page

Delete conversations


Introduction

ZIM supports users to delete a specific conversation or all conversations in the conversation list.

Delete a conversation

To delete a specified conversation after login, call the deleteConversation with the conversationID parameter.

Note

When deleting a specified conversation:

  • All messages in the conversation are not automatically deleted. If you need to delete both the conversation and all messages in the conversation, call the deleteAllMessage method. For details, see the chapter Delete all messages of the specified conversation of Delete messages.
  • If the conversation has unread messages, the total number of unread messages will be reduced and shown in the onConversationTotalUnreadMessageCountUpdated callback. For details, see the chapter Get the number of unread messages above.
title
// Delete a specified conversation
ZIMConversationDeleteConfig config = new ZIMConversationDeleteConfig();
config.isAlsoDeleteServerConversation = true;

zim.deleteConversation("CONV_ID", ZIMConversationType.PEER, config, new ZIMConversationDeletedCallback() {
    @Override
    public void onConversationDeleted(ZIMError errorInfo) {
        // The results of delete a specified result. 
        if(errorInfo.code == ZIMErrorCodeSuccess) {
          // ......
        } else {
          // ......
        }            
    }
});
1
Copied!

Delete all conversations

After the login, a user can delete all conversations in the conversation list by calling the deleteAllConversations interface.

Untitled
ZIMConversationDeleteConfig config = new ZIMConversationDeleteConfig();
config.isAlsoDeleteServerConversation = true;

zim.deleteAllConversations(config, new ZIMConversationsAllDeletedCallback() {
    @Override
    public void onConversationsAllDeleted(ZIMError errorInfo) {
             // Callback of deletion
        }
});
1
Copied!

Previous

Mute a conversation

Next

Pin a conversation