- Android
- iOS
- JavaScript
- Flutter
- ReactNative
When sending a message, you can set its lifetime. When the message expires, it is automatically destroyed by IM.
Code Example
MessageOptions o = new MessageOptions();
// Unit: milliseconds. This message will be automatically deleted after one day. The default is 0, which disables automatic destruction.
o.setLifeTime(24 * 60 * 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, Message.getDestroyTime() is automatically set to the message send time plus its lifetime. Use this time to render the UI.
When sending a message, you can set its lifetime. When the message expires, it is automatically destroyed by IM.
Code Example
JMessageOptions *o = [[JMessageOptions alloc] init];
// Unit: milliseconds. This message will be automatically deleted after one day. The default is 0, which disables automatic destruction.
o.lifeTime = 24 * 60 * 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 destroyTime property of JMessage is automatically set to the message send time plus its lifetime. Use this time to render the UI.
Not supported.
When sending a message, you can set its lifetime. When the message expires, it is automatically destroyed by IM.
Code Example
SendMessageOption option = SendMessageOption();
option.lifeTime = 24 * 60 * 60 * 1000; //unit: milliseconds
Message message = JuggleIm.instance.sendMessage(content, conversation, callback, option);
After a message is sent successfully, the destroyTime property of Message is automatically set to the message send time plus its lifetime. Use this time to render the UI.