SDKsAndroid
Set a conversation draft
Use setConversationDraft() to save an Android conversation draft.
Save the draft when a chat is left, the conversation changes, or editor content changes. Maintain editor state locally and debounce intermediate saves; submit the newest value before leaving the page.
OpenIMClient.getInstance().conversationManager.setConversationDraft(
new OnBase<String>() {
@Override
public void onSuccess(String data) {
markDraftSubmitted(conversationID);
}
@Override
public void onError(int code, String error) {
recordDraftSaveFailure(code, error);
}
},
conversationID,
editorValue
);Pass an empty string to clear the draft. Request completion and the later onConversationChanged update are separate; merge draftText and draftTextTime by conversationID, and clear in-memory editor state after logout or an account switch.
Was this page helpful?