Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Get active conversation count

Query the total count of active conversations currently stored in the local SDK database.

Copy

Query the total count of active conversation records cached by the local SDK engine:

Code example

import sdk, { GetActiveConversationCountResp } from '@openimsdk/imsdk';

const response: GetActiveConversationCountResp = await sdk.getActiveConversationCount();
showActiveConversationCount(response.count);

Return value

Returns a Promise that resolves to a GetActiveConversationCountResp object:

PropertyTypeDescription
countnumberTotal number of active conversation records in local storage.

State changes after the call

The returned count reflects local cached records; it is not equivalent to joined group counts, unread conversation counts, or the length of a single paginated slice. This query executes purely read-only and does not emit events. For conversation lifecycle listening, see Retrieve conversation list. Re-query whenever an authoritative conversation count is required.