SDKsAndroid
Remove group members
Use the Android SDK to remove specified members from a group.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
base | OnBase<String> | Yes | Callback handler for the asynchronous request. |
groupID | String | Yes | Globally unique ID of the target group. |
memberUserIDs | List<String> | Yes | List of member user IDs to remove from the group. |
reason | String | No | Optional 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
- Callback confirmation: The
onSuccesscallback indicates that the server has removed the specified members from the group. - Asynchronous event delivery: Affected clients and group members receive the
onGroupMemberDeletedevent delivering the removedGroupMembersInfo. The client should remove the corresponding member records from the local roster cache usinggroupID:userIDas the unique key. If the local user was removed,onGroupDismissedor membership synchronization removes the group conversation. - Re-query calibration: If member counts or rosters become inconsistent, call
getGroupMemberList()orgetSpecifiedGroupsInfo()to refresh data from the server.
For complete listener registration and lifecycle management, see Group overview.
Was this page helpful?