- Android
- iOS
- JavaScript
- Flutter
- ReactNative
When sending a message, you can set the burn-after-reading duration lifeTimeAfterRead. The message is destroyed after it has been read for lifeTimeAfterRead milliseconds.
Code Example
MessageOptions o = new MessageOptions();
// Unit: milliseconds. The message is automatically deleted five minutes after being read. The default is 0, which disables deletion after reading.
o.setLifeTimeAfterRead(5 * 60 * 1000);
TextMessage textMessage = new TextMessage("Text");
Conversation conversation = new Conversation(Conversation.ConversationType.PRIVATE, "111");
JIM.getInstance().getMessageManager().sendMessage(textMessage, conversation, o, new IMessageManager.ISendMessageCallback() {
@Override
public void onSuccess(Message message) {
}
@Override
public void onError(Message message, int errorCode) {
}
});
After a message is sent successfully, the recipient calls sendReadReceipt() to mark it as read.
For private messages, the countdown starts for both sender and recipient after the recipient reads the message.
For group messages, the recipient countdown starts after that user reads the message; the sender countdown starts after all other group members read it.
When the countdown starts, the SDK invokes onMessageDestroyTimeUpdate() and automatically sets Message.getDestroyTime() to the message read time plus lifeTimeAfterRead. Use this time to render the UI countdown.
Code Example
JIM.getInstance().getMessageManager().addDestroyListener("main", new IMessageManager.IMessageDestroyListener() {
@Override
public void onMessageDestroyTimeUpdate(String messageId, Conversation conversation, long destroyTime) {
}
});
When sending a message, you can set the burn-after-reading duration lifeTimeAfterRead. The message is destroyed after it has been read for lifeTimeAfterRead milliseconds.
Code Example
JMessageOptions *o = [[JMessageOptions alloc] init];
// Unit: milliseconds. The message is automatically deleted five minutes after being read. The default is 0, which disables deletion after reading.
o.lifeTimeAfterRead = 5 * 60 * 1000;
JTextMessage *textMessage = [[JTextMessage alloc] initWithContent:@"Text"];
JConversation *conversation = [[JConversation alloc] initWithConversationType:JConversationTypePrivate
conversationId:@"111"];
[JIM.shared.messageManager sendMessage:textMessage
messageOption:o
inConversation:conversation
success:^(JMessage *message) {
} error:^(JErrorCode errorCode, JMessage *message) {
}];
After a message is sent successfully, the recipient calls sendReadReceipt:inConversation:success:error: to mark it as read.
For private messages, the countdown starts for both sender and recipient after the recipient reads the message.
For group messages, the recipient countdown starts after that user reads the message; the sender countdown starts after all other group members read it.
When the countdown starts, the SDK invokes messageDestroyTimeDidUpdate:inconversation:destroyTime: and automatically sets Message.destroyTime to the message read time plus lifeTimeAfterRead. Use this time to render the UI countdown.
Code Example
[JIM.shared.messageManager addDestroyDelegate:self];
- (void)messageDestroyTimeDidUpdate:(NSString *)messageId inConversation:(JConversation *)conversation destroyTime:(long long)destroyTime {
}
Not supported.
When sending a message, you can set the burn-after-reading duration lifeTimeAfterRead. The message is destroyed after it has been read for lifeTimeAfterRead milliseconds.
Code Example
SendMessageOption option = SendMessageOption();
option.lifeTimeAfterRead = 5 * 60 * 1000; //unit: milliseconds
Message message = JuggleIm.instance.sendMessage(content, conversation, callback, option);
After a message is sent successfully, the recipient calls sendReadReceipt to mark it as read.
For private messages, the countdown starts for both sender and recipient after the recipient reads the message.
For group messages, the recipient countdown starts after that user reads the message; the sender countdown starts after all other group members read it.
When the countdown starts, the SDK invokes onMessageDestroyTimeUpdate and automatically sets Message.destroyTime to the message read time plus lifeTimeAfterRead. Use this time to render the UI countdown.
Code Example
JuggleIm.instance.onMessageDestroyTimeUpdate = (messageId, conversation, destroyTime) {
}