Skip to main content

Conversation Drafts

Save Draft

Supports saving a draft message to a specified conversation. Saving a draft will update the conversation's sentTime, causing the conversation order in the list to change, with this conversation moving to the front of the list.

Interface

 RongCoreClient.getInstance().saveTextMessageDraft(conversationType,targetId,content,callback); 

Parameter Description

ParameterTypeDescription
conversationTypeConversationTypeConversation type
targetIdStringConversation ID
contentStringText content of the draft
callbackResultCallback<Boolean>Callback interface

Example Code

ConversationType conversationType = ConversationType.PRIVATE;
String targetId = "Conversation ID";
String content = "Draft content";

RongCoreClient.getInstance().saveTextMessageDraft(
conversationType,
targetId,
content,
new IRongCoreCallback.ResultCallback<Boolean>() {
@Override
public void onSuccess(Boolean aBoolean) {

}

@Override
public void onError(IRongCoreEnum.CoreErrorCode e) {

}
});

Get Draft

Retrieves draft content.

Interface

RongCoreClient.getInstance().getTextMessageDraft(conversationType,targetId, callback);

Parameter Description

ParameterTypeDescription
conversationTypeConversationTypeConversation type
targetIdStringConversation ID
callbackResultCallback<String>Callback interface

Example Code

ConversationType conversationType = ConversationType.PRIVATE;
String targetId = "Conversation ID";

RongCoreClient.getInstance().getTextMessageDraft(
conversationType,
targetId,
new IRongCoreCallback.ResultCallback<String>() {
@Override
public void onSuccess(String s) {
}

@Override
public void onError(IRongCoreEnum.CoreErrorCode e) {

}
});

Delete Draft

After deleting a draft, since the conversation operation time has changed, the conversation order in the list will not change and will remain at the front of the conversation list.

Interface

 RongCoreClient.getInstance().clearTextMessageDraft(conversationType,targetId,callback);

Parameter Description

ParameterTypeDescription
conversationTypeConversationTypeConversation type
targetIdStringConversation ID
callbackResultCallback<Boolean>Callback interface

Example Code

ConversationType conversationType = ConversationType.PRIVATE;
String targetId = "Conversation ID";

RongCoreClient.getInstance().clearTextMessageDraft(
conversationType,
targetId,
new IRongCoreCallback.ResultCallback<Boolean>() {
@Override
public void onSuccess(Boolean aBoolean) {

}

@Override
public void onError(IRongCoreEnum.CoreErrorCode e) {

}
});