please select
  • UIKit
  • SDK
  • Server APIs
Chat/
SDK/
React Native/
Message/
SDK
  • Run Demo
  • SDK Integration
  • Initialization
  • Login and Logout
  • Message
    • Message Overview
    • Sending Message
    • Receiving Message
    • Historical Message
    • Forwarding Message
    • Modifying Message
    • Message Inserting
    • Deleting Message
    • Clearing Messages
    • Recalling Message
    • Online Message
    • Read Receipt
    • Querying Message
    • Group @ Message
    • Targeted Group Message
    • Notification Muting
    • Message Extension
  • Group
    • Overview
    • Group Management
    • Group Profile
    • Group Member Management
    • Group Member Profile
    • Custom Group Attribute
    • Community Management
  • User
    • User Profile
    • Friend Management
    • Friend List
    • Blocklist
  • Offline Push
    • Offline Push
  • Local Search
    • Searching for Message
    • Searching for Friend
    • Searching Group
    • Searching for Group Member
  • Signaling
    • Signaling Management
  • Changelog
  • Guideline for Beginners
  • Console Guide
    • Creating and Upgrading an Application
    • Basic Configuration
    • Feature Configuration
    • Account Management
    • Group Management
    • Webhook Configuration
  • Product Introduction
    • Message Management
      • One-to-One Message
      • Message Storage
      • Offline Push
      • Group Message
      • Message Formats
    • Account System
      • Login Authentication
      • Online Status Management
    • Group Related
      • Group System
      • Group Management
    • User Profile and Relationship Chain
      • Profile Management
      • Relationship Chain Management
  • Purchase Guide
    • Billing Overview
    • Pricing
  • Error Codes

Clearing Messages

Feature Description

One-to-one messages and group messages can be cleared. When messages in a conversation are cleared, all the messages in the conversation will be cleared both locally and from the cloud, but the conversation itself will not be deleted.
Note:
Do not use this API if you do not want to clear messages from the cloud.
If the last message is deleted, the lastMessage in the conversation will become the last but one message.

Clearing one-to-one messages

Call clearC2CHistoryMessage (Details) to clear one-to-one messages.
Below is the sample code:
TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.clearC2CHistoryMessage("userid");

Clearing group messages

Call clearGroupHistoryMessage (Details) to clear group messages.
Below is the sample code:
TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.clearGroupHistoryMessage("groupID");