Browse SDKs · Android
Platform
SDKsAndroid

Quit a group

Leave a specified group as the authenticated user using quitGroup().

Copy

Leave a specified group that the authenticated user currently belongs to. This operation affects only the leaving user; the group itself and other members remain active. Group owners must transfer ownership or dismiss the group before quitting.

Code example

String groupID = "group_123";

OpenIMClient.getInstance().groupManager.quitGroup(
    new OnBase<String>() {
        @Override
        public void onSuccess(String data) {
            // Group quitted successfully
        }

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

Parameters

ParameterTypeRequiredDescription
baseOnBase<String>YesCallback delivering the asynchronous operation result.
groupIDStringYesTarget group ID to quit.

Return value

The successful callback confirms that the server processed the exit operation.

State changes after the call

A successful callback confirms that the user was removed from the group on the server. The SDK then triggers the onJoinedGroupDeleted(GroupInfo group) event on OnGroupListener. Remove the group record matching groupID from your local joined groups list, and adjust or clear the associated group conversation view. For complete listener registration details, see Group overview.

For group owners transferring ownership before leaving, see Transfer group ownership; to terminate the group entirely, see Dismiss a group.