Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-docs-android-v6-beta2.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
AI Integration Quick Reference
AI Integration Quick Reference
- Adding a listener for real-time deletes when your app is running
- Fetching missed deletes when your app was offline
Delete a Message
UsedeleteMessage() with the message ID.
- Java
- Kotlin
| Field | Getter | Return Type | Description |
|---|---|---|---|
| deletedAt | getDeletedAt() | long | Timestamp when the message was deleted |
| deletedBy | getDeletedBy() | String | UID of the user who deleted the message |
onSuccess() callback, you get an object of the BaseMessage class, with the deletedAt field set with the timestamp of the time the message was deleted. Also, the deletedBy field is set. These two fields can be used to identify if the message is deleted while iterating through a list of messages.
By default, CometChat allows certain roles to delete a message.
| User Role | Conversation Type | Deletion Capabilities |
|---|---|---|
| Message Sender | One-on-one Conversation | Messages they’ve sent |
| Message Sender | Group Conversation | Messages they’ve sent |
| Group Admin | Group Conversation | All messages in the group |
| Group Moderator | Group Conversation | All messages in the group |
Real-time Message Delete Events
UseonMessageDeleted in MessageListener to receive real-time delete events.
- Java
- Kotlin
| Field | Getter | Return Type | Description |
|---|---|---|---|
| deletedAt | getDeletedAt() | long | Timestamp when the message was deleted |
| deletedBy | getDeletedBy() | String | UID of the user who deleted the message |
Missed Message Delete Events
When fetching message history, deleted messages havedeletedAt and deletedBy fields set. Additionally, an Action message is created when a message is deleted.
For the message deleted event, in the Action object received, the following fields can help you get the relevant information-
action-deletedactionOn- Updated message object which was deleted.actionBy- User object containing the details of the user who has deleted the message.actionFor- User/group object having the details of the receiver to which the message was sent.
In order to delete a message, you need to be either the sender of the message or the admin/moderator of the group in which the message was sent.
Next Steps
Edit Message
Modify text and custom messages after sending
Send Message
Send text, media, and custom messages
Receive Messages
Handle real-time message events with listeners
Message Structure
Understand message types and properties