跳到主要内容

会话草稿

保存草稿

  • 保存一条草稿内容至指定会话。
  • 保存草稿会更新会话 sentTime,该会话会排在列表前部。
ConversationType conversationType = ConversationType.PRIVATE;
String targetId = " 会话 Id ";
String content = "草稿内容";

RongIMClient.getInstance().saveTextMessageDraft(conversationType, targetId, content, new
ResultCallback<Boolean>() {

@Override
public void onSuccess(Boolean success) {

}

@Override
public void onError(RongIMClient.ErrorCode errorCode) {

}
})

参数类型说明
conversationTypeConversationType会话类型
targetIdString会话 Id
contentString草稿的文字内容
callbackResultCallback<Boolean>回调接口

获取草稿

获取草稿内容。

ConversationType conversationType = ConversationType.PRIVATE;
String targetId = " 会话 Id ";

RongIMClient.getInstance().getTextMessageDraft(conversationType, targetId, new
ResultCallback<String>() {

@Override
public void onSuccess(String draft) {

}

@Override
public void onError(RongIMClient.ErrorCode errorCode) {

}
});

参数类型说明
conversationTypeConversationType会话类型
targetIdString会话 Id
callbackResultCallback<String>回调接口

删除草稿

删除草稿。

ConversationType conversationType = ConversationType.PRIVATE;
String targetId = "会话 Id";

RongIMClient.getInstance().clearTextMessageDraft(conversationType, targetId, new ResultCallback<Boolean>() {

@Override
public void onSuccess(Boolean success) {

}

@Override
public void onError(RongIMClient.ErrorCode errorCode) {

}
});

参数类型说明
conversationTypeConversationType会话类型
targetIdString会话 Id
callbackResultCallback<Boolean>回调接口