Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Clear all local messages

Delete all cached messages for the current account on the local device.

Copy

Deletes all message history stored in local database storage on the current device for the signed-in account.

Code example

import sdk from '@openimsdk/imsdk';

await sdk.deleteAllMessageFromLocal();
resetAllMessageState();

Parameters

This method does not take any parameters.

Return value

Returns a Promise that resolves to void when the local database operation completes.

State changes after the call

This is an irreversible account-wide local operation. After the Promise resolves, immediately reset in-memory message lists, search indices, pagination cursors, and related caches for the current account. This action does not notify other devices or conversation participants; messages may still exist on the server and could reappear after full synchronization. To purge messages from both the local database and the server, see Clear all local and remote messages; to clear messages for a single conversation, see Clear conversation messages.