Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Get joined group count

Query the total number of groups joined by the current account.

Copy

Queries the total number of groups that the current account is currently a member of.

Code example

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

const response: GetJoinedGroupCountResp = await sdk.getJoinedGroupCount();
setJoinedGroupCount(response.count);

Parameters

This method does not take any parameters.

Return value

Returns a Promise resolving to GetJoinedGroupCountResp:

PropertyTypeDescription
countnumberNumber of groups joined by the current account.

State changes after the call

count represents the total joined groups at query time. The query itself does not trigger events. When group join or leave events occur, perform incremental count updates (see Group overview for full event listener setup), and recalibrate with this method upon reconnecting.