Browse SDKs · Android
Platform
SDKsAndroid

Check group membership

Verify whether the authenticated user is currently a member of a specified group using isJoinGroup().

Copy

Verify whether the authenticated user is already a member of a specified group. This is typically used to determine UI routing before entering a group from search results, shared links, or QR code scans.

Code example

String groupID = "group_123";

OpenIMClient.getInstance().groupManager.isJoinGroup(
    groupID,
    new OnBase<Boolean>() {
        @Override
        public void onSuccess(Boolean joined) {
            // joined is true if the authenticated user is a member of the group
        }

        @Override
        public void onError(int code, String error) {
            // Handle check failure
        }
    }
);

Parameters

ParameterTypeRequiredDescription
groupIDStringYesTarget group ID to verify.
baseOnBase<Boolean>YesCallback delivering the asynchronous operation result.

Return value

The successful callback returns a Boolean:

  • true: The current user is an active group member; navigate directly to the group chat screen.
  • false: The current user is not a group member; prompt the user to Apply to join a group.