Chat SDK for Android v1.1.0
agora java chat SDK
Classes | Public Member Functions | List of all members
io.agora.chat.GroupManager Class Reference

Classes

enum  GroupStyle
 

Public Member Functions

List< GroupgetAllGroups ()
 
Group getGroup (String groupId)
 
Group createGroup (String groupName, String desc, String[] allMembers, String reason, GroupOptions option) throws ChatException
 
void asyncCreateGroup (final String groupName, final String desc, final String[] allMembers, final String reason, final GroupOptions option, final ValueCallBack< Group > callback)
 
synchronized void loadAllGroups ()
 
void destroyGroup (final String groupId) throws ChatException
 
void asyncDestroyGroup (final String groupId, final CallBack callback)
 
void addUsersToGroup (String groupId, String[] newmembers) throws ChatException
 
void addUsersToGroup (String groupId, String[] newmembers, String welcomeMessage) throws ChatException
 
void asyncAddUsersToGroup (final String groupId, final String[] newmembers, final CallBack callback)
 
void removeUserFromGroup (final String groupId, final String username) throws ChatException
 
void asyncRemoveUserFromGroup (final String groupId, final String username, final CallBack callback)
 
void removeUsersFromGroup (final String groupId, final List< String > members) throws ChatException
 
void asyncRemoveUsersFromGroup (final String groupId, final List< String > members, final CallBack callback)
 
void leaveGroup (String groupId) throws ChatException
 
void asyncLeaveGroup (final String groupId, final CallBack callback)
 
Group getGroupFromServer (String groupId) throws ChatException
 
Group getGroupFromServer (String groupId, boolean fetchMembers) throws ChatException
 
void asyncGetGroupFromServer (final String groupId, final ValueCallBack< Group > callback)
 
synchronized List< GroupgetJoinedGroupsFromServer () throws ChatException
 
synchronized List< GroupgetJoinedGroupsFromServer (int pageIndex, int pageSize) throws ChatException
 
synchronized List< GroupgetJoinedGroupsFromServer (int pageIndex, int pageSize, boolean needMemberCount, boolean needRole) throws ChatException
 
void asyncGetJoinedGroupsFromServer (final ValueCallBack< List< Group > > callback)
 
void asyncGetJoinedGroupsFromServer (final int pageIndex, final int pageSize, final ValueCallBack< List< Group > > callback)
 
void asyncGetJoinedGroupsFromServer (final int pageIndex, final int pageSize, boolean needMemberCount, boolean needRole, final ValueCallBack< List< Group > > callback)
 
CursorResult< GroupInfogetPublicGroupsFromServer (int pageSize, String cursor) throws ChatException
 
void asyncGetPublicGroupsFromServer (final int pageSize, final String cursor, final ValueCallBack< CursorResult< GroupInfo > > callback)
 
void joinGroup (String groupId) throws ChatException
 
void asyncJoinGroup (final String groupId, final CallBack callback)
 
void changeGroupName (String groupId, String changedGroupName) throws ChatException
 
void asyncChangeGroupName (final String groupId, final String changedGroupName, final CallBack callback)
 
void changeGroupDescription (String groupId, String changedDescription) throws ChatException
 
void asyncChangeGroupDescription (final String groupId, final String changedDescription, final CallBack callBack)
 
Group acceptInvitation (String groupId, String inviter) throws ChatException
 
void asyncAcceptInvitation (final String groupId, final String inviter, final ValueCallBack< Group > callback)
 
void declineInvitation (String groupId, String inviter, String reason) throws ChatException
 
void asyncDeclineInvitation (final String groupId, final String inviter, final String reason, final CallBack callback)
 
void acceptApplication (String username, String groupId) throws ChatException
 
void asyncAcceptApplication (final String username, final String groupId, final CallBack callback)
 
void declineApplication (String username, String groupId, String reason) throws ChatException
 
void asyncDeclineApplication (final String username, final String groupId, final String reason, final CallBack callback)
 
void inviteUser (String groupId, String[] beInvitedUsernames, String reason) throws ChatException
 
void asyncInviteUser (final String groupId, final String[] beInvitedUsernames, final String reason, final CallBack callback)
 
void applyJoinToGroup (String groupId, String reason) throws ChatException
 
void asyncApplyJoinToGroup (final String groupId, final String reason, final CallBack callback)
 
void blockGroupMessage (String groupId) throws ChatException
 
void asyncBlockGroupMessage (final String groupId, final CallBack callback)
 
void unblockGroupMessage (String groupId) throws ChatException
 
void asyncUnblockGroupMessage (final String groupId, final CallBack callback)
 
void blockUser (String groupId, String username) throws ChatException
 
void asyncBlockUser (final String groupId, final String username, final CallBack callback)
 
void blockUsers (String groupId, List< String > members) throws ChatException
 
void asyncBlockUsers (final String groupId, final List< String > members, final CallBack callback)
 
void unblockUser (String groupId, String username) throws ChatException
 
void asyncUnblockUser (final String groupId, final String username, final CallBack callback)
 
void unblockUsers (String groupId, List< String > members) throws ChatException
 
void asyncUnblockUsers (final String groupId, final List< String > members, final CallBack callback)
 
List< String > getBlockedUsers (String groupId) throws ChatException
 
List< String > getBlockedUsers (String groupId, int pageIndex, int pageSize) throws ChatException
 
void asyncGetBlockedUsers (final String groupId, final ValueCallBack< List< String > > callback)
 
void asyncGetBlockedUsers (final String groupId, final int pageIndex, final int pageSize, final ValueCallBack< List< String > > callback)
 
void addGroupChangeListener (GroupChangeListener listener)
 
void removeGroupChangeListener (GroupChangeListener listener)
 
CursorResult< String > fetchGroupMembers (String groupId, String cursor, int pageSize) throws ChatException
 
void asyncFetchGroupMembers (final String groupId, final String cursor, final int pageSize, final ValueCallBack< CursorResult< String > > callback)
 
Group changeOwner (String groupId, String newOwner) throws ChatException
 
void asyncChangeOwner (final String groupId, final String newOwner, final ValueCallBack< Group > callback)
 
Group addGroupAdmin (final String groupId, final String admin) throws ChatException
 
void asyncAddGroupAdmin (final String groupId, final String admin, final ValueCallBack< Group > callback)
 
Group removeGroupAdmin (String groupId, String admin) throws ChatException
 
void asyncRemoveGroupAdmin (final String groupId, final String admin, final ValueCallBack< Group > callback)
 
Group muteGroupMembers (String groupId, List< String > muteMembers, long duration) throws ChatException
 
void asyncMuteGroupMembers (final String groupId, final List< String > muteMembers, final long duration, final ValueCallBack< Group > callback)
 
Group unMuteGroupMembers (String groupId, List< String > members) throws ChatException
 
void asyncUnMuteGroupMembers (final String groupId, final List< String > members, final ValueCallBack< Group > callback)
 
Map< String, Long > fetchGroupMuteList (String groupId, int pageNum, int pageSize) throws ChatException
 
void asyncFetchGroupMuteList (final String groupId, final int pageNum, final int pageSize, final ValueCallBack< Map< String, Long > > callBack)
 
List< String > fetchGroupBlackList (String groupId, int pageNum, int pageSize) throws ChatException
 
void asyncFetchGroupBlackList (final String groupId, final int pageNum, final int pageSize, final ValueCallBack< List< String > > callBack)
 
void addToGroupWhiteList (final String groupId, final List< String > members, final CallBack callBack)
 
void removeFromGroupWhiteList (final String groupId, final List< String > members, final CallBack callBack)
 
void checkIfInGroupWhiteList (final String groupId, ValueCallBack< Boolean > callBack)
 
void fetchGroupWhiteList (final String groupId, final ValueCallBack< List< String > > callBack)
 
void muteAllMembers (final String groupId, final ValueCallBack< Group > callBack)
 
void unmuteAllMembers (final String groupId, final ValueCallBack< Group > callBack)
 
void updateGroupAnnouncement (String groupId, String announcement) throws ChatException
 
void asyncUpdateGroupAnnouncement (final String groupId, final String announcement, final CallBack callBack)
 
String fetchGroupAnnouncement (String groupId) throws ChatException
 
void asyncFetchGroupAnnouncement (final String groupId, final ValueCallBack< String > callBack)
 
MucSharedFile uploadGroupSharedFile (String groupId, String filePath, CallBack callBack) throws ChatException
 
void asyncUploadGroupSharedFile (final String groupId, final String filePath, final CallBack callBack)
 
void asyncUploadGroupSharedFile (final String groupId, final String filePath, final ValueCallBack< MucSharedFile > callBack)
 
List< MucSharedFilefetchGroupSharedFileList (String groupId, int pageNum, int pageSize) throws ChatException
 
void asyncFetchGroupSharedFileList (final String groupId, final int pageNum, final int pageSize, final ValueCallBack< List< MucSharedFile > > callBack)
 
void deleteGroupSharedFile (String groupId, String fileId) throws ChatException
 
void asyncDeleteGroupSharedFile (final String groupId, final String fileId, final CallBack callBack)
 
void downloadGroupSharedFile (String groupId, String fileId, String savePath, CallBack callBack) throws ChatException
 
void asyncDownloadGroupSharedFile (final String groupId, final String fileId, final String savePath, final CallBack callBack)
 
Group updateGroupExtension (String groupId, String extension) throws ChatException
 

Detailed Description

The group manager for management of group creation and deletion and member management.

Member Function Documentation

◆ acceptApplication()

void io.agora.chat.GroupManager.acceptApplication ( String  username,
String  groupId 
) throws ChatException

Approves a group request. Only the group owner or admin can call this method. For the asynchronous method, see asyncAcceptApplication(String, String, CallBack).

This is a synchronous method and blocks the current thread.

Parameters
usernameThe ID of the user who sends a request to join the group.
groupIdThe group ID.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ acceptInvitation()

Group io.agora.chat.GroupManager.acceptInvitation ( String  groupId,
String  inviter 
) throws ChatException

Accepts a group invitation. For the asynchronous method, see asyncAcceptInvitation(String, String, ValueCallBack)

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
inviterThe user who initiates the invitation.
Returns
The group instance which the user has accepted the invitation to join.
Exceptions
ChatExceptionA description of the exception. see Error.

◆ addGroupAdmin()

Group io.agora.chat.GroupManager.addGroupAdmin ( final String  groupId,
final String  admin 
) throws ChatException

Adds a group admin. Only the group owner can call this method and admin can not. For the asynchronous method, see asyncAddGroupAdmin(String, String, ValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
adminThe admin ID to add.
Returns
The updated group instance.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ addGroupChangeListener()

void io.agora.chat.GroupManager.addGroupChangeListener ( GroupChangeListener  listener)

Registers a group change listener. The registered listener needs to be used together with removeGroupChangeListener(GroupChangeListener).

Parameters
listenerThe group event listener to be registered.

◆ addToGroupWhiteList()

void io.agora.chat.GroupManager.addToGroupWhiteList ( final String  groupId,
final List< String >  members,
final CallBack  callBack 
)

Adds members to the allowlist. Only the group owner or admin can call this method.

This is an asynchronous method.

Parameters
groupIdThe group ID.
membersThe members to be added to the allowlist.
callBackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ addUsersToGroup() [1/2]

void io.agora.chat.GroupManager.addUsersToGroup ( String  groupId,
String[]  newmembers 
) throws ChatException

Adds users to the group. Only the group creator or admin can call this method. For the asynchronous method, see asyncAddUsersToGroup(String, String[], CallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
newmembersThe array of new members to add.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ addUsersToGroup() [2/2]

void io.agora.chat.GroupManager.addUsersToGroup ( String  groupId,
String[]  newmembers,
String  welcomeMessage 
) throws ChatException

Adds users to the group. Only the group owner or admin can call this method. For the asynchronous method, see asyncAddUsersToGroup(String, String[], CallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
newmembersThe array of new members to add.
welcomeMessageThe welcome message.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ applyJoinToGroup()

void io.agora.chat.GroupManager.applyJoinToGroup ( String  groupId,
String  reason 
) throws ChatException

Requests to join a group. Note: The group style is GroupStyle#GroupStylePublicJoinNeedApproval, which is a public group requiring authentication. For an asynchronous method, see asyncApplyJoinToGroup(String, String, CallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
reasonThe reason for requesting to join the group.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ asyncAcceptApplication()

void io.agora.chat.GroupManager.asyncAcceptApplication ( final String  username,
final String  groupId,
final CallBack  callback 
)

Approves a group request. Only the group owner or admin can call this method. For the synchronous method, see acceptApplication(String, String).

This is an asynchronous method.

Parameters
usernameThe ID of the user who sends the request to join the group.
groupIdThe group ID.
callbackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String) if it does not.

◆ asyncAcceptInvitation()

void io.agora.chat.GroupManager.asyncAcceptInvitation ( final String  groupId,
final String  inviter,
final ValueCallBack< Group callback 
)

Accepts a group invitation. For the synchronous method, see acceptInvitation(String, String).

This is an asynchronous method.

Parameters
groupIdThe group ID.
inviterThe inviter ID.
callbackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and returns the updated group instance; if this call fails, calls ValueCallBack#onError(int, String).

◆ asyncAddGroupAdmin()

void io.agora.chat.GroupManager.asyncAddGroupAdmin ( final String  groupId,
final String  admin,
final ValueCallBack< Group callback 
)

Adds a group admin. Only the group owner can call this method and admin can not. For the synchronous method, see addGroupAdmin(String, String)

This is an asynchronous method.

Parameters
groupIdThe group ID.
adminThe new owner ID.
callbackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and returns the updated group instance; If this call fails, calls ValueCallBack#onError(int, String).

◆ asyncAddUsersToGroup()

void io.agora.chat.GroupManager.asyncAddUsersToGroup ( final String  groupId,
final String[]  newmembers,
final CallBack  callback 
)

Adds users to the group. Only the group owner or admin can call this method. For the synchronous method, see addUsersToGroup(String, String[]).

This is an asynchronous method.

Parameters
groupIdThe group ID.
newmembersThe array of new members to add.
callbackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); If this call fails, calls CallBack#onError(int, String).

◆ asyncApplyJoinToGroup()

void io.agora.chat.GroupManager.asyncApplyJoinToGroup ( final String  groupId,
final String  reason,
final CallBack  callback 
)

Requests to join a group. Note: The group style is GroupStyle#GroupStylePublicJoinNeedApproval, which is a public group requiring authentication. For the synchronous method, see applyJoinToGroup(String, String).

This is an asynchronous method.

Parameters
groupIdThe group ID.
reasonThe reason for requesting to joining the group.
callbackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ asyncBlockGroupMessage()

void io.agora.chat.GroupManager.asyncBlockGroupMessage ( final String  groupId,
final CallBack  callback 
)

Blocks group messages. The user that blocks group messages is still a group member, but can't receive group messages. For the synchronous method, see blockGroupMessage(String).

This is an asynchronous method.

Parameters
groupIdThe group ID.
callbackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ asyncBlockUser()

void io.agora.chat.GroupManager.asyncBlockUser ( final String  groupId,
final String  username,
final CallBack  callback 
)

Adds the user to the group blocklist. Users will be first removed from the group they have joined before being added to the group blocklist. The users on the group blocklist can not join the group again. Only the group owner or admin can call this method. For the synchronous method, see blockUser(String, String).

This is an asynchronous method.

Parameters
groupIdThe group ID.
usernameThe user to be added to the blocklist.
callbackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); If this call fails, calls CallBack#onError(int, String).

◆ asyncBlockUsers()

void io.agora.chat.GroupManager.asyncBlockUsers ( final String  groupId,
final List< String >  members,
final CallBack  callback 
)

Adds the user to the group blocklist. Users will be first removed from the group they have joined before being added to the group blocklist. The users on the group blocklist can not join the group again. Only the group owner or admin can call this method. For the synchronous method, see blockUsers(String, List).

This is an asynchronous method.

Parameters
groupIdThe group ID.
membersThe list of users to be blocked.
callbackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ asyncChangeGroupDescription()

void io.agora.chat.GroupManager.asyncChangeGroupDescription ( final String  groupId,
final String  changedDescription,
final CallBack  callBack 
)

Changes the group description. Only the group owner or admin can call this method. For the synchronous method, see changeGroupDescription(String, String).

This is an asynchronous method.

Parameters
groupIdThe group ID.
changedDescriptionThe new group description.
callBackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ asyncChangeGroupName()

void io.agora.chat.GroupManager.asyncChangeGroupName ( final String  groupId,
final String  changedGroupName,
final CallBack  callback 
)

Changes the group name. Only the group owner or admin can call this method. For the synchronous method, see changeGroupName(String, String).

This is an asynchronous method.

Parameters
groupIdThe ID of group whose name is to be changed.
changedGroupNameThe new group name.
callbackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ asyncChangeOwner()

void io.agora.chat.GroupManager.asyncChangeOwner ( final String  groupId,
final String  newOwner,
final ValueCallBack< Group callback 
)

Transfers the group ownership. Only the group owner can call this method. For the synchronous method, see changeOwner(String, String)

This is an asynchronous method.

Parameters
groupIdThe group ID.
newOwnerThe new owner ID.
callbackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and returns the updated group instance; if this call fails, calls ValueCallBack#onError(int, String).

◆ asyncCreateGroup()

void io.agora.chat.GroupManager.asyncCreateGroup ( final String  groupName,
final String  desc,
final String[]  allMembers,
final String  reason,
final GroupOptions  option,
final ValueCallBack< Group callback 
)

Creates a group instance. After the group is created, the data in the cache and database will be updated and multiple devices will receive the notification event and update the group to the cache and database. You can set io.agora.MultiDeviceListener to listen on the event. The event callback function is io.agora.MultiDeviceListener#onGroupEvent(int, String, List), where the first parameter is the event, for example, io.agora.MultiDeviceListener#GROUP_CREATE for the group creation event.

This is an asynchronous method.

Parameters
groupNameThe group name. It is optional. Pass null if you do not want to set this parameter.
descThe group description. It is optional. Pass null if you do not want to set this parameter.
allMembersThe group member array. The group owner ID is optional. This parameter can not be null.
reasonThe group joining invitation. It is optional. Pass null if you do not want to set this parameter.
optionThe options for creating a group. They are optional and can not be null. See GroupOptions. The options are as follows:
  • The maximum number of group members. The default value is 200.
  • The group style. See GroupStyle. The default value is GroupStyle#GroupStylePrivateOnlyOwnerInvite.
  • Whether to ask for permission when inviting a user to joining the group. The default value is false, indicating that invitees are automaticall added to the group without their permission.
  • The group detail extensions.
callbackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and returns the created group object; If this call fails, calls ValueCallBack#onError(int, String).

◆ asyncDeclineApplication()

void io.agora.chat.GroupManager.asyncDeclineApplication ( final String  username,
final String  groupId,
final String  reason,
final CallBack  callback 
)

Declines a group request. Only the group owner or admin can call this method. For the synchronous method, see declineApplication(String, String, String).

This is an asynchronous method.

Parameters
usernameThe ID of the user who sends the request for join the group.
groupIdThe group ID.
reasonThe reason of declining.
callbackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ asyncDeclineInvitation()

void io.agora.chat.GroupManager.asyncDeclineInvitation ( final String  groupId,
final String  inviter,
final String  reason,
final CallBack  callback 
)

Declines a group invitation. For the synchronous method, see declineInvitation(String, String, String).

This is an asynchronous method.

Parameters
groupIdThe group ID.
inviterThe inviter ID.
reasonThe reason for declining.
callbackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ asyncDeleteGroupSharedFile()

void io.agora.chat.GroupManager.asyncDeleteGroupSharedFile ( final String  groupId,
final String  fileId,
final CallBack  callBack 
)

Removes the shared file of the group. Group members can delete their own uploaded files. The group owner or admin can delete all shared files. For the synchronous method, see deleteGroupSharedFile(String, String).

This is an asynchronous method.

Parameters
groupIdThe group ID.
fileIdThe shared file ID.
callBackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ asyncDestroyGroup()

void io.agora.chat.GroupManager.asyncDestroyGroup ( final String  groupId,
final CallBack  callback 
)

Destroys the group instance. Only the group owner can call this method. For the synchronous method, see destroyGroup(String).

This is an asynchronous method.

Parameters
groupIdThe group ID.
callbackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ asyncDownloadGroupSharedFile()

void io.agora.chat.GroupManager.asyncDownloadGroupSharedFile ( final String  groupId,
final String  fileId,
final String  savePath,
final CallBack  callBack 
)

Downloads the shared file of the group. For synchronous method, see downloadGroupSharedFile(String, String, String, CallBack).

This is an asynchronous method.

Parameters
groupIdThe group ID.
fileIdThe shared file ID.
savePathThe file path.
callBackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String). Calls CallBack#onProgress(int, String) to view the file download progress.

◆ asyncFetchGroupAnnouncement()

void io.agora.chat.GroupManager.asyncFetchGroupAnnouncement ( final String  groupId,
final ValueCallBack< String >  callBack 
)

Gets the group announcement from the server. Group members can call this method. For the synchronous method, see fetchGroupAnnouncement(String).

This is an asynchronous method.

Parameters
groupIdThe group ID.
callBackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object); if this call fails, calls ValueCallBack#onError(int, String).

◆ asyncFetchGroupBlackList()

void io.agora.chat.GroupManager.asyncFetchGroupBlackList ( final String  groupId,
final int  pageNum,
final int  pageSize,
final ValueCallBack< List< String > >  callBack 
)

Gets the blocklist of group from the server with pagination. Only the group owner or admin can call this method. For the synchronous method, see fetchGroupBlackList(String, int, int).

This is an asynchronous method.

Parameters
groupIdThe group ID.
pageNumThe page number, starting from 1.
pageSizeThe number of users on the blocklist per page.
callBackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and returns the group blocklist on the next page; if this call fails, calls ValueCallBack#onError(int, String).

◆ asyncFetchGroupMembers()

void io.agora.chat.GroupManager.asyncFetchGroupMembers ( final String  groupId,
final String  cursor,
final int  pageSize,
final ValueCallBack< CursorResult< String > >  callback 
)

Gets a group's member list with pagination. For the synchronous method, see fetchGroupMembers(String, String, int).

This is an asynchronous method.

Parameters
groupIdThe group ID.
cursorThe number of group members per page.
pageSizeThe cursor position from which to start to get data next time. Sets the parameter as null for the first time.
callbackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and returns the result of CursorResult, including the cursor for getting data next time and the group member list. For the last page, the return value of cursor is an empty string. If this call fails, calls ValueCallBack#onError(int, String).

◆ asyncFetchGroupMuteList()

void io.agora.chat.GroupManager.asyncFetchGroupMuteList ( final String  groupId,
final int  pageNum,
final int  pageSize,
final ValueCallBack< Map< String, Long > >  callBack 
)

Gets the mutelist of the group from the server. Only the group owner or admin can call this method. For the asynchronous method, see fetchGroupMuteList(String, int, int).

This is an asynchronous method.

Parameters
groupIdThe group ID.
pageNumThe page number, starting from 1.
pageSizeThe number of muted members per page.
callBackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and The map which contains the muted member ID and mute duration, where the key of each entry is the ID of a muted member and the value is the mute duration in milliseconds. If this call fails, calls ValueCallBack#onError(int, String).

◆ asyncFetchGroupSharedFileList()

void io.agora.chat.GroupManager.asyncFetchGroupSharedFileList ( final String  groupId,
final int  pageNum,
final int  pageSize,
final ValueCallBack< List< MucSharedFile > >  callBack 
)

Gets the shared file list from the server. For the synchronous method, see fetchGroupSharedFileList(String, int, int).

This is an asynchronous method.

Parameters
groupIdThe group ID.
pageNumThe page number, starting from 1.
pageSizeThe number of shared files per page.
callBackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and returns the shared files; if this call fails, calls ValueCallBack#onError(int, String).

Note the following:

  • pageSize specifies the number of shared files expected to return for this call. For the last page, the actual number of returned shared files is less than the value of pageSize.
  • pageNum specifies the number of the current page on which the returned data is presented. For a large but unknown quantity of data, the server will return data as specified by pageSize and pageNum.

◆ asyncGetBlockedUsers() [1/2]

void io.agora.chat.GroupManager.asyncGetBlockedUsers ( final String  groupId,
final int  pageIndex,
final int  pageSize,
final ValueCallBack< List< String > >  callback 
)

Gets the group blocklist with pagination. Only the group owner or admin can call this method. For the synchronous method, see getBlockedUsers(String, int, int).

This is an asynchronous method.

Parameters
groupIdThe group ID.
pageIndexThe page number, starting from 1.
pageSizeThe number of groups per page.
callbackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and returns the group blocklist; if this call fails, calls ValueCallBack#onError(int, String).

◆ asyncGetBlockedUsers() [2/2]

void io.agora.chat.GroupManager.asyncGetBlockedUsers ( final String  groupId,
final ValueCallBack< List< String > >  callback 
)

Gets the group blocklist that can contain a maximum of 200 users by default. Only the group owner or admin can call this method. For the synchronous method, see getBlockedUsers(String).

This is an asynchronous method.

Parameters
groupIdThe group ID.
callbackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object); if this call fails, calls ValueCallBack#onError(int, String).

◆ asyncGetGroupFromServer()

void io.agora.chat.GroupManager.asyncGetGroupFromServer ( final String  groupId,
final ValueCallBack< Group callback 
)

Gets group information from the server. For the synchronous method, see getGroupFromServer(String).

This is an asynchronous method.

Parameters
groupIdThe group ID.
callbackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ asyncGetJoinedGroupsFromServer() [1/3]

void io.agora.chat.GroupManager.asyncGetJoinedGroupsFromServer ( final int  pageIndex,
final int  pageSize,
boolean  needMemberCount,
boolean  needRole,
final ValueCallBack< List< Group > >  callback 
)

Gets all groups of the current user from the server with pagination. This method returns a group list which does not contain member information. If you want to update information of a group to include its member information, call getGroupFromServer(String groupId). For the synchronous method, see getJoinedGroupsFromServer(int, int, boolean, boolean).

This is an asynchronous method.

Parameters
pageIndexThe page number, starting from 0.
pageSizeThe number of groups per page.pageSize max 20
needMemberCountWhether the number of group members is required.
needRoleWhether the user's role in the group is required.
callbackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and returns the group list on the next page; if this call fails, calls ValueCallBack#onError(int, String);

◆ asyncGetJoinedGroupsFromServer() [2/3]

void io.agora.chat.GroupManager.asyncGetJoinedGroupsFromServer ( final int  pageIndex,
final int  pageSize,
final ValueCallBack< List< Group > >  callback 
)

Gets all groups of the current user from the server with pagination. This method returns a group list which does not contain member information. If you want to update information of a group to include its member information, call getGroupFromServer(String groupId). For the synchronous method, see getJoinedGroupsFromServer(int, int).

This is an asynchronous method.

Parameters
pageIndexThe page number, starting from 1.
pageSizeThe number of groups per page.
callbackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and returns the group list on the next page; if this call fails, calls ValueCallBack#onError(int, String);
Deprecated:
Deprecated. Please use asyncGetJoinedGroupsFromServer(int, int, boolean, boolean, ValueCallBack) instead.

◆ asyncGetJoinedGroupsFromServer() [3/3]

void io.agora.chat.GroupManager.asyncGetJoinedGroupsFromServer ( final ValueCallBack< List< Group > >  callback)

Gets all groups of the current user from the server. This method returns a group list which does not contain member information. If you want to update information of a group to include its member information, call getGroupFromServer(String groupId). For a synchronous method, see getJoinedGroupsFromServer().

This is an asynchronous method.

Parameters
callbackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and returns the list of groups that the user has joined; if the call fails, calls ValueCallBack#onError(int, String).

◆ asyncGetPublicGroupsFromServer()

void io.agora.chat.GroupManager.asyncGetPublicGroupsFromServer ( final int  pageSize,
final String  cursor,
final ValueCallBack< CursorResult< GroupInfo > >  callback 
)

Gets public groups from the server with pagination. For the synchronous method, see getPublicGroupsFromServer(int, String).

This is an asynchronous method.

Parameters
pageSizeThe number of public groups per page.
cursorThe cursor position from which to start getting data next time. Sets the parameter as null for the first time.
callbackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and returns the result of CursorResult), including the cursor for getting data next time and the group list. For the last page, the return value of cursor is an empty string. If this call fails, calls ValueCallBack#onError(int, String).

◆ asyncInviteUser()

void io.agora.chat.GroupManager.asyncInviteUser ( final String  groupId,
final String[]  beInvitedUsernames,
final String  reason,
final CallBack  callback 
)

Invites users to join a group. Note: The group style is GroupStyle#GroupStylePrivateMemberCanInvite, which allows group members to invite users. For the synchronous method, see inviteUser(String, String[], String)

The is an asynchronous method.

Parameters
groupIdThe group ID.
beInvitedUsernamesThe array of users to be invited.
reasonThe reason for invitation.
callbackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ asyncJoinGroup()

void io.agora.chat.GroupManager.asyncJoinGroup ( final String  groupId,
final CallBack  callback 
)

Joins a public group. For a group that requires no authentication,users can join it freely without the need of having permission. For a group that requires authentication, users need to wait for the owner to agree before joing the group. For details, see GroupStyle. For the synchronous method, see joinGroup(String).

This is an asynchronous method.

Parameters
groupIdThe group ID.
callbackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ asyncLeaveGroup()

void io.agora.chat.GroupManager.asyncLeaveGroup ( final String  groupId,
final CallBack  callback 
)

Leaves a group.

This is an asynchronous method.

Parameters
groupIdThe group ID.
callbackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); If this call fails, calls CallBack#onError(int, String).

◆ asyncMuteGroupMembers()

void io.agora.chat.GroupManager.asyncMuteGroupMembers ( final String  groupId,
final List< String >  muteMembers,
final long  duration,
final ValueCallBack< Group callback 
)

Mutes group members. Only the group owner or admin can call this method. For the synchronous method, see muteGroupMembers(String, List, long).

This is an asynchronous method.

Parameters
groupIdThe group ID.
muteMembersThe list of members to be muted.
durationThe mute duration in milliseconds.
callbackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and returns the updated group instance; If this call fails, calls ValueCallBack#onError(int, String).

◆ asyncRemoveGroupAdmin()

void io.agora.chat.GroupManager.asyncRemoveGroupAdmin ( final String  groupId,
final String  admin,
final ValueCallBack< Group callback 
)

Removes a group admin. Only the group owner can call this method. For the synchronous method, see removeGroupAdmin(String, String).

This is an asynchronous method.

Parameters
groupIdThe group ID.
adminThe admin ID to remove.
callbackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and returns the updated group instance; if this call succeeds, calls ValueCallBack#onError(int, String).

◆ asyncRemoveUserFromGroup()

void io.agora.chat.GroupManager.asyncRemoveUserFromGroup ( final String  groupId,
final String  username,
final CallBack  callback 
)

Removes a member from the group. Only the group owner or admin can call this method. For the synchronous method, see removeUserFromGroup(String, String).

This is an asynchronous method.

Parameters
groupIdThe group ID.
usernameThe user ID of the member to be removed.
callbackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ asyncRemoveUsersFromGroup()

void io.agora.chat.GroupManager.asyncRemoveUsersFromGroup ( final String  groupId,
final List< String >  members,
final CallBack  callback 
)

Removes members from the group. Only the group owner or admin can call this method. For the synchronous method, see removeUsersFromGroup(String, List).

This is an asynchronous method.

Parameters
groupIdThe group ID.
membersThe user IDs of members to be removed.
callbackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ asyncUnblockGroupMessage()

void io.agora.chat.GroupManager.asyncUnblockGroupMessage ( final String  groupId,
final CallBack  callback 
)

Unblocks group messages. For the synchronous method, see unblockGroupMessage(String).

This is an asynchronous method.

Parameters
groupIdThe group ID
callbackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ asyncUnblockUser()

void io.agora.chat.GroupManager.asyncUnblockUser ( final String  groupId,
final String  username,
final CallBack  callback 
)

Removes a user from the group blocklist. Only the group owner or admin can call this method. For the synchronous method, see unblockUser(String, String).

This is an asynchronous method.

Parameters
groupIdThe group ID.
usernameThe user to be removed from the group blocklist.
callbackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ asyncUnblockUsers()

void io.agora.chat.GroupManager.asyncUnblockUsers ( final String  groupId,
final List< String >  members,
final CallBack  callback 
)

Removes users from the group blocklist. Only the group owner or admin can call this method. For the synchronous method, see unblockUsers(String, List).

This is an asynchronous method.

Parameters
groupIdThe group ID.
membersThe users to be removed from the bloclist.
callbackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ asyncUnMuteGroupMembers()

void io.agora.chat.GroupManager.asyncUnMuteGroupMembers ( final String  groupId,
final List< String >  members,
final ValueCallBack< Group callback 
)

Unmutes group members. Only the group owner or admin can call this method. For the synchronious method, see unMuteGroupMembers(String, List).

This is an asynchronous method.

Parameters
groupIdThe group ID.
membersThe list of members to be unmuted.
callbackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and returns the updated group instance; if this call fails, calls ValueCallBack#onError(int, String).

◆ asyncUpdateGroupAnnouncement()

void io.agora.chat.GroupManager.asyncUpdateGroupAnnouncement ( final String  groupId,
final String  announcement,
final CallBack  callBack 
)

Updates the group announcement. Only the group owner or admin can call this method. For the synchronous method, see updateGroupAnnouncement(String, String)

This is an asynchronous method.

Parameters
groupIdThe group ID.
announcementThe group announcement.
callBackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ asyncUploadGroupSharedFile() [1/2]

void io.agora.chat.GroupManager.asyncUploadGroupSharedFile ( final String  groupId,
final String  filePath,
final CallBack  callBack 
)

Uploads the shared file to the group.

For the synchronous method, see uploadGroupSharedFile(String, String, CallBack).

This is an asynchronous method.

Parameters
groupIdThe group ID.
filePathThe local file path.
callBackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String). Calls CallBack#onSuccess() to view the upload progress. @Deprecated Deprecated. Please use asyncUploadGroupSharedFile(String, String, ValueCallBack) instead.

◆ asyncUploadGroupSharedFile() [2/2]

void io.agora.chat.GroupManager.asyncUploadGroupSharedFile ( final String  groupId,
final String  filePath,
final ValueCallBack< MucSharedFile callBack 
)

Uploads the shared file to the group.

For the synchronous method, see uploadGroupSharedFile(String, String, CallBack).

This is an asynchronous method.

Parameters
groupIdThe group ID.
filePathThe local file path.
callBackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object); if this call fails, calls ValueCallBack#onError(int, String). Calls ValueCallBack#onSuccess(Object) to view the upload progress.

◆ blockGroupMessage()

void io.agora.chat.GroupManager.blockGroupMessage ( String  groupId) throws ChatException

Blocks group messages. The user that blocks group messages is still a group member, but can't receive group messages. For the asynchronous method, see asyncBlockGroupMessage(String, CallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ blockUser()

void io.agora.chat.GroupManager.blockUser ( String  groupId,
String  username 
) throws ChatException

Adds the user to the group blocklist. Users will be first removed from the group they have joined before being added to the group blocklist. The users on the group blocklist can not join the group again. Only the group owner or admin can call this method. For the asynchronous method, see asyncBlockUser(String, String, CallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
usernameThe user to be added to the blocklist.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ blockUsers()

void io.agora.chat.GroupManager.blockUsers ( String  groupId,
List< String >  members 
) throws ChatException

Adds the user to the group blocklist. Users will be first removed from the group they have joined before being added to the group blocklist. The users on the group blocklist can not join the group again. Only the group owner or admin can call this method. For the asynchronous method, see asyncBlockUsers(String, List, CallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
membersThe list of users to be added to the blocklist.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ changeGroupDescription()

void io.agora.chat.GroupManager.changeGroupDescription ( String  groupId,
String  changedDescription 
) throws ChatException

Changes the group description. Only the group owner or admin can call this method. For the asynchronous method, see asyncChangeGroupDescription(String, String, CallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
changedDescriptionThe new group description.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ changeGroupName()

void io.agora.chat.GroupManager.changeGroupName ( String  groupId,
String  changedGroupName 
) throws ChatException

Changes the group name. Only the group owner or admin can call this method. For the asynchronous method, see asyncChangeGroupName(String, String, CallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe ID of group whose name is to be changed.
changedGroupNameThe new group name.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ changeOwner()

Group io.agora.chat.GroupManager.changeOwner ( String  groupId,
String  newOwner 
) throws ChatException

Transfers the group ownership. Only the group owner can call this method. For the asynchronous method, see asyncChangeOwner(String, String, ValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
newOwnerThe new owner ID.
Returns
The updated group instance.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ checkIfInGroupWhiteList()

void io.agora.chat.GroupManager.checkIfInGroupWhiteList ( final String  groupId,
ValueCallBack< Boolean >  callBack 
)

Gets whether the member is on the allowlist.

This is an asynchronous method.

Parameters
groupIdThe group ID.
callBackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and returns a Boolean value to indicate whether the current user is on the group blocklist; if this call fails, calls ValueCallBack#onError(int, String).

◆ createGroup()

Group io.agora.chat.GroupManager.createGroup ( String  groupName,
String  desc,
String[]  allMembers,
String  reason,
GroupOptions  option 
) throws ChatException

Creates a group instance. After the group is created, the data in the cache and database will be updated and multiple devices will receive the notification event and update the group to the cache and database. You can set io.agora.MultiDeviceListener to listen on the event. The event callback function is io.agora.MultiDeviceListener#onGroupEvent(int, String, List), where the first parameter is the event, for example, io.agora.MultiDeviceListener#GROUP_CREATE for the group creation event. For the asynchronous method, see asyncCreateGroup(String, String, String[], String, GroupOptions, ValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupNameThe group name. It is optional. Pass null if you do not want to set this parameter.
descThe group description. It is optional. Pass null if you do not want to set this parameter.
allMembersThe group member array. The group owner ID is optional. This parameter can not be null.
reasonThe group joining invitation. It is optional. Pass null if you do not want to set this parameter.
optionThe options for creating a group. They are optional and can not be null. See GroupOptions. The options are as follows:
  • The maximum number of group members. The default value is 200.
  • The group style. See GroupStyle. The default value is GroupStyle#GroupStylePrivateOnlyOwnerInvite.
  • Whether to ask for permission when inviting a user to joing the group. The default value is false, indicating that invitees are automaticall added to the group without their permission.
  • The group detail extensions.
Returns
The created group instance.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ declineApplication()

void io.agora.chat.GroupManager.declineApplication ( String  username,
String  groupId,
String  reason 
) throws ChatException

Declines a group request. Only the group owner or admin can call this method. For the asynchronous method, see asyncDeclineApplication(String, String, String, CallBack).

Only the group owner or admin can call this method.

Parameters
usernameThe ID of the user who sends the request for join the group.
groupIdThe group ID.
reasonThe reason of declining.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ declineInvitation()

void io.agora.chat.GroupManager.declineInvitation ( String  groupId,
String  inviter,
String  reason 
) throws ChatException

Declines a group invitation. For the asynchronous method, see asyncDeclineInvitation(String, String, String, CallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
inviterThe inviter.
reasonThe reason for declining.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ deleteGroupSharedFile()

void io.agora.chat.GroupManager.deleteGroupSharedFile ( String  groupId,
String  fileId 
) throws ChatException

Removes a shared file of the group. Group members can delete their own uploaded files. The group owner or admin can delete all shared files. For the asynchronous method, see asyncDeleteGroupSharedFile(String, String, CallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
fileIdThe shared file ID.
Exceptions
ChatExceptionOnly the group owner or admin can call this method. See Error.

◆ destroyGroup()

void io.agora.chat.GroupManager.destroyGroup ( final String  groupId) throws ChatException

Destroys the group instance. Only the group owner can call this method. For the asynchronous method, see asyncDestroyGroup(String, CallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ downloadGroupSharedFile()

void io.agora.chat.GroupManager.downloadGroupSharedFile ( String  groupId,
String  fileId,
String  savePath,
CallBack  callBack 
) throws ChatException

Downloads the shared file of the group. Note: The callback is only used for progress callback. For the asynchronous method, see asyncDownloadGroupSharedFile(String, String, String, CallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
fileIdThe ID of the shared file.
savePathThe local file path.
callBackThe file download progress callback.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ fetchGroupAnnouncement()

String io.agora.chat.GroupManager.fetchGroupAnnouncement ( String  groupId) throws ChatException

Gets the group announcement from the server. Group members can call this method. For the asynchronous method, see asyncFetchGroupAnnouncement(String, ValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
Returns
The group announcement.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ fetchGroupBlackList()

List< String > io.agora.chat.GroupManager.fetchGroupBlackList ( String  groupId,
int  pageNum,
int  pageSize 
) throws ChatException

Gets the blocklist of group from the server with pagination. Only the group owner or admin can call this method. For the asynchronous method, see asyncFetchGroupBlackList(String, int, int, ValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
pageNumThe page number, starting from 1.
pageSizeThe number of users on the blocklist per page.
Returns
The group blocklist on the next page.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ fetchGroupMembers()

CursorResult< String > io.agora.chat.GroupManager.fetchGroupMembers ( String  groupId,
String  cursor,
int  pageSize 
) throws ChatException

Gets a group's member list with pagination. When CursorResult.getCursor() is an empty string ("") in the result, there is no more data. For the asynchronous method, see asyncFetchGroupMembers(String, String, int, ValueCallBack).

Synchronization method will block the current thread.

For example:

CursorResult result = fetchGroupMembers(groupId, cursor, pageSize); // search 1
result = fetchGroupMembers(groupId, result.getCursor(), pageSize); // search 2
CursorResult< String > fetchGroupMembers(String groupId, String cursor, int pageSize)
Definition: GroupManager.java:2913
Parameters
groupIdThe group ID.
cursorThe cursor position from which to start to get data next time. Sets the parameter as null for the first time.
pageSizeThe number of group members per page.
Returns
The result of CursorResult, including the cursor for getting data next time and the group member list. For the last page, the return value of cursor is an empty string.
Exceptions
ChatExceptionA description of the exception. See Error

◆ fetchGroupMuteList()

Map< String, Long > io.agora.chat.GroupManager.fetchGroupMuteList ( String  groupId,
int  pageNum,
int  pageSize 
) throws ChatException

Gets the mutelist of the group from the server. Only the group owner or admin can call this method. For the asynchronous method, see asyncFetchGroupMuteList(String, int, int, ValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
pageNumThe page number, starting from 1.
pageSizeThe cursor position from which to start to get data next time.
Returns
A map which contains the muted member ID and mute duration, where the key of each entry is the ID of a muted member and the value is the mute duration in milliseconds.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ fetchGroupSharedFileList()

List< MucSharedFile > io.agora.chat.GroupManager.fetchGroupSharedFileList ( String  groupId,
int  pageNum,
int  pageSize 
) throws ChatException

Gets the shared files of group from the server. For the asynchronous method, see asyncFetchGroupSharedFileList(String, int, int, ValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
pageNumThe page number, starting from 1.
pageSizeThe number of shared files per page.
Returns
The shared files.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ fetchGroupWhiteList()

void io.agora.chat.GroupManager.fetchGroupWhiteList ( final String  groupId,
final ValueCallBack< List< String > >  callBack 
)

Gets the allowlist of group from the server. Only the group owner or admin can call this method.

This is an asynchronous method.

Parameters
groupIdThe group ID.
callBackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and return the group blocklist; if this call fails, calls ValueCallBack#onError(int, String).

◆ getAllGroups()

List< Group > io.agora.chat.GroupManager.getAllGroups ( )

Gets all groups of the current user (from the cache). Before a call to this method, call loadAllGroups() to load data from the group to the cache. If loadAllGroups() is not called, this method will load data from the database before loading from the cache.

Returns
The group list.

◆ getBlockedUsers() [1/2]

List< String > io.agora.chat.GroupManager.getBlockedUsers ( String  groupId) throws ChatException

Gets the group blocklist that can contain a maximum of 200 users by default. Only the group owner or admin can call this method. For the asynchronous method, see asyncGetBlockedUsers(String, ValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
Returns
List The group blocklist.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ getBlockedUsers() [2/2]

List< String > io.agora.chat.GroupManager.getBlockedUsers ( String  groupId,
int  pageIndex,
int  pageSize 
) throws ChatException

Gets the group blocklist from server with pagination. Only the group owner or admin can call this method. For the asynchronous method, see asyncGetBlockedUsers(String, int, int, ValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
pageIndexThe page number, starting from 1.
pageSizeThe number of groups per page.
Returns
List The group blocklist.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ getGroup()

Group io.agora.chat.GroupManager.getGroup ( String  groupId)

Gets the group instance from the cache by group ID.

Parameters
groupIdThe group ID.
Returns
The group instance. Returns null if the group does not exist.

◆ getGroupFromServer() [1/2]

Group io.agora.chat.GroupManager.getGroupFromServer ( String  groupId) throws ChatException

Gets group information from the server. This method does not get member information. If member information is required, call fetchGroupMembers(String, String, int). For the asynchronous method, see asyncGetGroupFromServer(String, ValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
Returns
Group The group instance.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ getGroupFromServer() [2/2]

Group io.agora.chat.GroupManager.getGroupFromServer ( String  groupId,
boolean  fetchMembers 
) throws ChatException

Gets group information from the server. If fetchMembers is set to true, a member list is also fetched. If more members need to be fetched, call fetchGroupMembers(String, String, int). Only members in the group can get the member list of the group.

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
fetchMembersWhether to get group members. By default, a list of 200 members is fetched.
Returns
Group The updated group instance.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ getJoinedGroupsFromServer() [1/3]

synchronized List< Group > io.agora.chat.GroupManager.getJoinedGroupsFromServer ( ) throws ChatException

Gets all groups of the current user from the server. This method returns a group list which does not contain member information. If you want to update information of a group to include its member information, call getGroupFromServer(String groupId). For the asynchronous method, see asyncGetJoinedGroupsFromServer(ValueCallBack).

This is a synchronous method and blocks the current thread.

Returns
The list of groups that the current user joins.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ getJoinedGroupsFromServer() [2/3]

synchronized List< Group > io.agora.chat.GroupManager.getJoinedGroupsFromServer ( int  pageIndex,
int  pageSize 
) throws ChatException

Gets all groups of the current user from the server with pagination. This method returns a group list which does not contain member information. If you want to update information of a group to include its member information, call getGroupFromServer(String groupId). For the asynchronous method, see asyncGetJoinedGroupsFromServer(int, int, ValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
pageIndexThe page number, starting from 1.
pageSizeThe number of groups per page.
Returns
The group list on the next page.
Exceptions
ChatExceptionA description of the exception. See Error.
Deprecated:
Deprecated. Please use getJoinedGroupsFromServer(int, int, boolean, boolean) instead.

◆ getJoinedGroupsFromServer() [3/3]

synchronized List< Group > io.agora.chat.GroupManager.getJoinedGroupsFromServer ( int  pageIndex,
int  pageSize,
boolean  needMemberCount,
boolean  needRole 
) throws ChatException

Gets all groups of the current user from the server with pagination. This method returns a group list which does not contain member information. If you want to update information of a group to include its member information, call getGroupFromServer(String groupId). For the asynchronous method, see asyncGetJoinedGroupsFromServer(int, int, boolean, boolean, ValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
pageIndexThe page number, starting from 0.
pageSizeThe number of groups per page. pageSize max 20
needMemberCountWhether the number of group members is required.
needRoleWhether the user's role in the group is required.
Returns
The group list on the next page.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ getPublicGroupsFromServer()

CursorResult< GroupInfo > io.agora.chat.GroupManager.getPublicGroupsFromServer ( int  pageSize,
String  cursor 
) throws ChatException

Gets public groups from the server with pagination. For the asynchronous method, see asyncGetPublicGroupsFromServer(int, String, ValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
pageSizeThe number of public groups per page.
cursorThe cursor position from which to start to get data next time. Sets the parameter as null for the first time.
Returns
The result of CursorResult, including the cursor for getting data next time and the group list. For the last page, the return value of cursor is an empty string.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ inviteUser()

void io.agora.chat.GroupManager.inviteUser ( String  groupId,
String[]  beInvitedUsernames,
String  reason 
) throws ChatException

Invites users to join a group. Note: The group style is GroupStyle#GroupStylePrivateMemberCanInvite, which allows group members to invite users. For the asynchronous method, see asyncInviteUser(String, String[], String, CallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
beInvitedUsernamesThe array of users to be invited.
reasonThe reason for invitation.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ joinGroup()

void io.agora.chat.GroupManager.joinGroup ( String  groupId) throws ChatException

Joins a public group. For a group that requires no authentication,users can join it freely without the need of having permission. For a group that requires authentication, users need to wait for the owner to agree before joing the group. For details, see GroupStyle. For the asynchronous method, see asyncJoinGroup(String, CallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ leaveGroup()

void io.agora.chat.GroupManager.leaveGroup ( String  groupId) throws ChatException

Leaves a group.

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ loadAllGroups()

synchronized void io.agora.chat.GroupManager.loadAllGroups ( )

Loads all local groups from the database.

◆ muteAllMembers()

void io.agora.chat.GroupManager.muteAllMembers ( final String  groupId,
final ValueCallBack< Group callBack 
)

Mutes all members. Only the group owner or admin can call this method.

This is an asynchronous method.

Parameters
groupIdThe group ID.
callBackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and returns the updated group instance; if this call fails, calls ValueCallBack#onError(int, String).

◆ muteGroupMembers()

Group io.agora.chat.GroupManager.muteGroupMembers ( String  groupId,
List< String >  muteMembers,
long  duration 
) throws ChatException

Mutes group members. Only the group owner or admin can call this method. For the asynchronous method, see asyncMuteGroupMembers(String, List, long, ValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
muteMembersThe list of members to be muted.
durationThe mute duration in milliseconds.
Returns
The updated group instance.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ removeFromGroupWhiteList()

void io.agora.chat.GroupManager.removeFromGroupWhiteList ( final String  groupId,
final List< String >  members,
final CallBack  callBack 
)

Removes members from the allowlist. Only the group owner or admin can call this method.

This is an asynchronous method.

Parameters
groupIdThe group ID.
membersThe members to be removed from the allowlist.
callBackThe completion callback. If this call succeeds, calls CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String).

◆ removeGroupAdmin()

Group io.agora.chat.GroupManager.removeGroupAdmin ( String  groupId,
String  admin 
) throws ChatException

Removes a group admin. Only the group owner can call this method. For the asynchronous method, see asyncRemoveGroupAdmin(String, String, ValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
adminThe admin ID to remove.
Returns
The updated group instance.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ removeGroupChangeListener()

void io.agora.chat.GroupManager.removeGroupChangeListener ( GroupChangeListener  listener)

Removes a group change listener. This method removes a group change listener registered with addGroupChangeListener(GroupChangeListener).

Parameters
listenerThe group event listener to be removed.

◆ removeUserFromGroup()

void io.agora.chat.GroupManager.removeUserFromGroup ( final String  groupId,
final String  username 
) throws ChatException

Removes a member from the group. Only the group owner or admin can call this method. For the asynchronous method, see asyncRemoveUserFromGroup(String, String, CallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
usernameThe user ID of the member to be removed.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ removeUsersFromGroup()

void io.agora.chat.GroupManager.removeUsersFromGroup ( final String  groupId,
final List< String >  members 
) throws ChatException

Removes members from the group. Only the group owner or admin can call this method. For the asynchronous method, see removeUsersFromGroup(String, List)}.

Only the group owner or admin can call this method.

Parameters
groupIdThe group ID.
membersThe user IDs of members to be removed.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ unblockGroupMessage()

void io.agora.chat.GroupManager.unblockGroupMessage ( String  groupId) throws ChatException

Unblocks group messages. For the asynchronous method, see asyncUnblockGroupMessage(String, CallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ unblockUser()

void io.agora.chat.GroupManager.unblockUser ( String  groupId,
String  username 
) throws ChatException

Removes a user from the group blocklist. Only the group owner or admin can call this method. For the asynchronous method, see asyncUnblockUser(String, String, CallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
usernameThe user to be removed from the group blocklist.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ unblockUsers()

void io.agora.chat.GroupManager.unblockUsers ( String  groupId,
List< String >  members 
) throws ChatException

Removes users from the group blocklist. Only the group owner or admin can call this method. For the asynchronous method, see asyncBlockUsers(String, List, CallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
membersThe users to be removed from the group blocklist.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ unmuteAllMembers()

void io.agora.chat.GroupManager.unmuteAllMembers ( final String  groupId,
final ValueCallBack< Group callBack 
)

Unmutes all members. Only the group owner or admin can call this method.

This is an asynchronous method.

Parameters
groupIdThe group ID.
callBackThe completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and returns the updated group instance; if this call fails, calls ValueCallBack#onError(int, String).

◆ unMuteGroupMembers()

Group io.agora.chat.GroupManager.unMuteGroupMembers ( String  groupId,
List< String >  members 
) throws ChatException

Unmutes group members. Only the group owner or admin can call this method. For the asynchronous method, see asyncUnMuteGroupMembers(String, List, ValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
membersThe list of members to be muted.
Returns
The updated group instance.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ updateGroupAnnouncement()

void io.agora.chat.GroupManager.updateGroupAnnouncement ( String  groupId,
String  announcement 
) throws ChatException

Updates the group announcement. Only the group owner or admin can call this method. For the asynchronous method, see asyncUpdateGroupAnnouncement(String, String, CallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
announcementThe group announcement.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ updateGroupExtension()

Group io.agora.chat.GroupManager.updateGroupExtension ( String  groupId,
String  extension 
) throws ChatException

Updates the group extension field. Only the group owner or admin can call this method.

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
extensionThe group extension field.
Exceptions
ChatExceptionA description of the exception. See Error.

◆ uploadGroupSharedFile()

MucSharedFile io.agora.chat.GroupManager.uploadGroupSharedFile ( String  groupId,
String  filePath,
CallBack  callBack 
) throws ChatException

Uploads the shared file to the group. Note: The callback is only used for progress callback. For the asynchronous method, see asyncUploadGroupSharedFile(String, String, ValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
filePathThe local file path.
callBackThe file upload progress callback.
Returns
The attribute object of the shared file.
Exceptions
ChatExceptionA description of the exception. See Error.

The documentation for this class was generated from the following file: