Browse SDKs · Android
Platform
SDKsAndroid

Manage group administrators

Use SetGroupMemberInfo.roleLevel to change a member’s role in a group.

Copy

Update the administrative role level of a specified group member. Group owners can promote regular members to administrators or demote administrators back to regular members. To transfer group ownership, see Transfer group ownership.

Code example

SetGroupMemberInfo update = new SetGroupMemberInfo();
update.setGroupID("group_123");
update.setUserID("user_b");
update.setRoleLevel(GroupRole.ADMIN);

OpenIMClient.getInstance().groupManager.setGroupMemberInfo(
    update,
    new OnBase<String>() {
        @Override
        public void onSuccess(String data) {
            // Group member role updated successfully
        }

        @Override
        public void onError(int code, String error) {
            // Failed to update group member role
        }
    }
);

Role constants

Use constants defined in GroupRole to set the roleLevel:

ConstantValueDescription
GroupRole.MEMBER20Regular group member.
GroupRole.ADMIN60Group administrator with member management and mute privileges.

Parameters

ParameterTypeRequiredDescription
groupMemberInfoSetGroupMemberInfoYesMember update object. Must specify groupID, member userID, and the new role level constant roleLevel.
baseOnBase<String>YesCallback handler for the asynchronous request.

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 role change was committed on the server.
  2. Asynchronous event delivery: Group members receive the onGroupMemberInfoChanged event delivering the updated GroupMembersInfo. The client should merge the updated roleLevel into the cached member record using groupID:userID as the unique key.
  3. Re-query calibration: If administrator rosters diverge, call Get group owners and admins to reload the verified administrative list.

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