Browse SDKs · Android
SDKsAndroid

Create a group

Use createGroup to create a group profile and specify its initial members, administrators, and owner.

Copy

Use createGroup() to create a group. Set the group profile in GroupInfo, and pass the initial regular members, administrators, and owner as separate parameters. The success callback returns the complete GroupInfo, including the new group's groupID.

GroupInfo info = new GroupInfo();
info.setGroupName("Project discussion");
info.setIntroduction("For project members only");

OpenIMClient.getInstance().groupManager.createGroup(
    memberUserIDs, adminUserIDs, info, ownerUserID,
    new OnBase<GroupInfo>() {
        @Override public void onSuccess(GroupInfo group) { /* group contains the new group profile. */ }
        @Override public void onError(int code, String error) { /* code and error describe the failure. */ }
    }
);