Group Member List
This document describes how the application layer (App) provides group member data to the Global IM UIKit SDK, which is used in the default member selection interface that pops up when entering the @ symbol in a group chat session, and in the member selection interface for initiating group audio and video calls. Once set up, the Global IM UIKit UI can display the avatars, usernames, or group nicknames of group members when showing the group member list.
RC's server does not provide user and group information hosting services to the SDK. Therefore, the group information required by the SDK must be actively obtained by the application developer from the App server and provided to the SDK.
Understanding the Group Member Provider Interface
The SDK defines the group member provider (GroupMembersProvider
). When the Global IM UIKit UI needs to display the group member list, it triggers the getGroupMembers
method of GroupMembersProvider
to fetch group member information from the application layer.
Application developers must implement the ConfigCenter.getUserInfoConfig().setGroupMembersProvider()
method for the SDK to obtain the App's group member data. If the SDK cannot retrieve the group members, the member selection interface will display an empty list.
public interface GroupMembersProvider {
void getGroupMembers(String groupId, Callback callback);
interface Callback {
void onGetGroupMembersResult(List<UserInfo> members)
}
}
Setting the Group Member Provider
After initialization, call the setGroupMembersProvider
method of UserInfoConfig
to set the group member information provider. The group member data required by the SDK must be actively obtained by the application developer from the application layer (e.g., the App server).
When the Global IM UIKit UI needs to display the group member list, the SDK triggers the getGroupMembers
callback and provides the group ID. You can use the group ID to fetch the user IDs within the group, then query user information from the application layer based on the user IDs, and finally provide the UserInfo
list to the SDK via GroupMembersProvider.Callback
.
If the App implements the group member user information provider, it can be used to fetch group member nicknames. For details, see Group Member User Information.
ConfigCenter.getUserInfoConfig.setGroupMembersProvider(new GroupMembersProvider() {
@Override
public void getGroupMembers(String groupId, Callback callback) {
//groupId is the group ID. You can fetch user IDs within the group based on the group ID, and then retrieve user information based on the IDs.
//Code as follows
List<UserInfo> list=new ArrayList();
UserInfo userInfo=new UserInfo("userid1","Xiao Hua 22", Uri.parse(""));
...
list.add(userInfo);
list.add...
callback.onGetGroupMembersResult(list); // Call the onGetGroupMembersResult method of callback to return the group information
}
});