Browse SDKs · Android
Platform
SDKsAndroid

Remove group members

Use the Android SDK to remove specified members from a group.

Copy

Group owners and administrators can remove specified members from a group. Removed members lose access to group messaging and are no longer part of the conversation.

Code example

String groupID = "group_123";
List<String> memberUserIDs = Arrays.asList("user_a", "user_b");
String reason = "Violation of group communication rules";

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

        @Override
        public void onError(int code, String error) {
            // Failed to remove group members
        }
    },
    groupID,
    memberUserIDs,
    reason
);

Parameters

ParameterTypeRequiredDescription
baseOnBase<String>YesCallback handler for the asynchronous request.
groupIDStringYesGlobally unique ID of the target group.
memberUserIDsList<String>YesList of member user IDs to remove from the group.
reasonStringNoOptional explanation or reason for removal. Pass an empty string if not needed.

Return value

Upon success, data in onSuccess returns a confirmation message.

State changes after the call

  1. Callback confirmation: The onSuccess callback indicates that the server has removed the specified members from the group.
  2. Asynchronous event delivery: Affected clients and group members receive the onGroupMemberDeleted event delivering the removed GroupMembersInfo. The client should remove the corresponding member records from the local roster cache using groupID:userID as the unique key. If the local user was removed, onGroupDismissed or membership synchronization removes the group conversation.
  3. Re-query calibration: If member counts or rosters become inconsistent, call getGroupMemberList() or getSpecifiedGroupsInfo() to refresh data from the server.

For complete listener registration and lifecycle management, see Group overview.