logo
In-app Chat
SDK Error Codes
Powered Byspreading
On this page

Manage room info


ZEGOCLOUD's In-app Chat (the ZIM SDK) provides the capability of room info queries, such as getting the room member list, querying the number of online members in the room, and more.

Note

You can only implement the following features in the room you created or joined.

Get room member list

After joining a room, to know who are in the current room and get the room member list, call the queryRoomMemberList method with roomID and config parameters, and the room member list will return through the callback onRoomMemberQueried of ZIMRoomMemberQueriedCallback method.

The config parameter refers to the configurations for querying room members. You will need to configure the parameters of the class ZIMRoomMemberQueryConfig according to the following:

ParameterTypeRequiredDescription
nextFlagstringYes

The paging identifier. Set this to null for the first query.

If the nextFlag field returned in the callback is not null, which means the query is not completed. In this case, you need to set it to the current position to continue the query on the next page.

countintYes

The number of room members that can be obtained in a query.

Note: To save overhead, we recommend you to obtain less than 100 members at a time.

Untitled
ZIMRoomMemberQueryConfig ZIMRoomMemberQueryConfig = new ZIMQueryMemberConfig();
zimRoomMemberQueryConfig.count = 100;
zim.queryRoomMemberList(roomID, config, new ZIMRoomMemberQueriedCallback() {
            @Override
            public void onRoomMemberQueried(String roomID, ArrayList<ZIMUserInfo> memberList, String nextFlag, ZIMError errorInfo) {
                
            }
});
1
Copied!

Get the number of online room members

To get the number of the online room members, call the queryRoomOnlineMemberCount method with the roomID.

Untitled
zim.queryRoomOnlineMemberCount(roomID, new ZIMRoomOnlineMemberCountQueriedCallback() {
            @Override
            public void onRoomOnlineMemberCountQueried(String roomID, int count, ZIMError errorInfo) {

            }
 });
1
Copied!
Note

A room member automatically gets offline if he calls the logout method to log out from the room.

Previous

Manage rooms

Next

Manage room properties