Conversation Draft
Save Draft
- Save a draft to a specified conversation.
- Saving a draft will update the
sentTime
of the conversation, causing it to move to the top of the list.
ConversationType conversationType = ConversationType.PRIVATE;
String targetId = "Conversation ID";
String content = "Draft content";
RongIMClient.getInstance().saveTextMessageDraft(conversationType, targetId, content, new
ResultCallback<Boolean>() {
@Override
public void onSuccess(Boolean success) {
}
@Override
public void onError(RongIMClient.ErrorCode errorCode) {
}
})
Parameter | Type | Description |
---|---|---|
conversationType | ConversationType | Conversation type |
targetId | String | Conversation ID |
content | String | Draft content |
callback | ResultCallback<Boolean> | Callback interface |
Get Draft
Retrieve draft content.
ConversationType conversationType = ConversationType.PRIVATE;
String targetId = "Conversation ID";
RongIMClient.getInstance().getTextMessageDraft(conversationType, targetId, new
ResultCallback<String>() {
@Override
public void onSuccess(String draft) {
}
@Override
public void onError(RongIMClient.ErrorCode errorCode) {
}
});
Parameter | Type | Description |
---|---|---|
conversationType | ConversationType | Conversation type |
targetId | String | Conversation ID |
callback | ResultCallback<String> | Callback interface |
Delete Draft
Delete a draft.
ConversationType conversationType = ConversationType.PRIVATE;
String targetId = "Conversation ID";
RongIMClient.getInstance().clearTextMessageDraft(conversationType, targetId, new ResultCallback<Boolean>() {
@Override
public void onSuccess(Boolean success) {
}
@Override
public void onError(RongIMClient.ErrorCode errorCode) {
}
});
Parameter | Type | Description |
---|---|---|
conversationType | ConversationType | Conversation type |
targetId | String | Conversation ID |
callback | ResultCallback<Boolean> | Callback interface |