Group overview
Understand group concepts, core data models, and group management capabilities in the OpenIM Android SDK.
Multi-user chat scenarios in OpenIM rely on groups to maintain shared profiles, membership rosters, and permission policies. A groupID uniquely identifies a group; use it when sending group messages, querying group metadata, moderating members, or reviewing join applications. In contrast, the user's chat list entry for the group is tracked by conversationID.
Core data types
| Type | Description |
|---|---|
GroupInfo | Group name, avatar, announcement, owner, verification mode, member count, and custom extension fields. |
GroupMembersInfo | In-group member nickname, role, mute status, and join timestamp. |
GroupApplicationInfo | Join applications and their current review statuses. |
Member roles are represented by GroupRole constants: MEMBER (standard member), ADMIN (administrator), and OWNER (group owner).
Key capabilities
- Create a group and Update group profile
- Set group join verification and Set group announcement
- Apply to join a group, Quit a group, and Dismiss a group
- Get specified groups info and Get joined group list
- Get received group applications and Accept a group application
- Get group member list and Get group owner and admins
- Invite users to a group and Remove a group member
State updates
Register OnGroupListener before logging in to receive real-time notifications for group profile modifications, member changes, and join applications. Merge group states locally using groupID as the primary key, and merge group member states using groupID:userID:
private final OnGroupListener groupListener = new OnGroupListener() {
@Override
public void onJoinedGroupAdded(GroupInfo group) {
// Refresh joined groups list, merging by group.getGroupID()
}
@Override
public void onJoinedGroupDeleted(GroupInfo group) {
// Remove group.getGroupID() from the joined groups list
}
@Override
public void onGroupInfoChanged(GroupInfo group) {
// Refresh group profile matching group.getGroupID()
}
@Override
public void onGroupDismissed(GroupInfo group) {
// Flag group as dismissed and update active chat views matching group.getGroupID()
}
@Override
public void onGroupMemberAdded(GroupMembersInfo member) {
// Incrementally add member to group member list for member.getGroupID()
}
@Override
public void onGroupMemberDeleted(GroupMembersInfo member) {
// Remove member matching member.getGroupID() and member.getUserID()
}
@Override
public void onGroupMemberInfoChanged(GroupMembersInfo member) {
// Update member role, nickname, or mute status for member.getGroupID() and member.getUserID()
}
@Override
public void onGroupApplicationAdded(GroupApplicationInfo application) {
// Refresh join applications list
}
@Override
public void onGroupApplicationAccepted(GroupApplicationInfo application) {
// Refresh join applications list
}
@Override
public void onGroupApplicationRejected(GroupApplicationInfo application) {
// Refresh join applications list
}
@Override
public void onGroupApplicationDeleted(GroupApplicationInfo application) {
// Refresh join applications list
}
};
public void registerGroupListener() {
OpenIMClient.getInstance().groupManager.setOnGroupListener(groupListener);
}A successful API callback indicates that the local or remote operation succeeded. Reconcile in-memory lists and member caches using listener events, or re-query paginated endpoints when recovering state after network disconnections.
Was this page helpful?