SDKsAndroid
Clear all saved messages
Use deleteAllMsgFromLocalAndSvr to clear local and server-side messages.
deleteAllMsgFromLocalAndSvr() clears the current account's local messages and requests deletion of that account's server-side message history. This is a high-impact operation; explain its scope and require confirmation.
OpenIMClient.getInstance().messageManager.deleteAllMsgFromLocalAndSvr(
new OnBase<String>() {
@Override
public void onSuccess(String data) {
// Clear message lists and related UI state for the current account.
}
@Override
public void onError(int code, String error) {
// Do not clear only the UI; keep existing data and report the failure.
}
}
);The success callback means the deletion request completed. It does not delete message copies retained by other users, and it does not remove friendships, groups, or conversation relationships. Query a conversation again if its messages must be shown later.
Was this page helpful?