hyphenate_SDK4.0 4.8.0
hyphenate java IM SDK
Classes | Public Member Functions | List of all members
com.hyphenate.chat.EMGroupManager Class Reference

Classes

enum  EMGroupStyle
 

Public Member Functions

List< EMGroupgetAllGroups ()
 
EMGroup getGroup (String groupId)
 
EMGroup createGroup (String groupName, String desc, String[] allMembers, String reason, EMGroupOptions option) throws HyphenateException
 
void asyncCreateGroup (final String groupName, final String desc, final String[] allMembers, final String reason, final EMGroupOptions option, final EMValueCallBack< EMGroup > callback)
 
synchronized void loadAllGroups ()
 
void destroyGroup (final String groupId) throws HyphenateException
 
void asyncDestroyGroup (final String groupId, final EMCallBack callback)
 
void addUsersToGroup (String groupId, String[] newmembers) throws HyphenateException
 
void addUsersToGroup (String groupId, String[] newmembers, String welcomeMessage) throws HyphenateException
 
void asyncAddUsersToGroup (final String groupId, final String[] newmembers, final EMCallBack callback)
 
void removeUserFromGroup (final String groupId, final String username) throws HyphenateException
 
void asyncRemoveUserFromGroup (final String groupId, final String username, final EMCallBack callback)
 
void removeUsersFromGroup (final String groupId, final List< String > members) throws HyphenateException
 
void asyncRemoveUsersFromGroup (final String groupId, final List< String > members, final EMCallBack callback)
 
void leaveGroup (String groupId) throws HyphenateException
 
void asyncLeaveGroup (final String groupId, final EMCallBack callback)
 
EMGroup getGroupFromServer (String groupId) throws HyphenateException
 
EMGroup getGroupFromServer (String groupId, boolean fetchMembers) throws HyphenateException
 
void asyncGetGroupFromServer (final String groupId, final EMValueCallBack< EMGroup > callback)
 
synchronized List< EMGroupgetJoinedGroupsFromServer () throws HyphenateException
 
synchronized List< EMGroupgetJoinedGroupsFromServer (int pageIndex, int pageSize) throws HyphenateException
 
synchronized List< EMGroupgetJoinedGroupsFromServer (int pageIndex, int pageSize, boolean needMemberCount, boolean needRole) throws HyphenateException
 
void asyncGetJoinedGroupsFromServer (final EMValueCallBack< List< EMGroup > > callback)
 
void asyncGetJoinedGroupsFromServer (final int pageIndex, final int pageSize, final EMValueCallBack< List< EMGroup > > callback)
 
void asyncGetJoinedGroupsFromServer (final int pageIndex, final int pageSize, boolean needMemberCount, boolean needRole, final EMValueCallBack< List< EMGroup > > callback)
 
void asyncGetJoinedGroupsCountFromServer (final EMValueCallBack< Integer > callback)
 
EMCursorResult< EMGroupInfogetPublicGroupsFromServer (int pageSize, String cursor) throws HyphenateException
 
void asyncGetPublicGroupsFromServer (final int pageSize, final String cursor, final EMValueCallBack< EMCursorResult< EMGroupInfo > > callback)
 
void joinGroup (String groupId) throws HyphenateException
 
void asyncJoinGroup (final String groupId, final EMCallBack callback)
 
void changeGroupName (String groupId, String changedGroupName) throws HyphenateException
 
void asyncChangeGroupName (final String groupId, final String changedGroupName, final EMCallBack callback)
 
void changeGroupDescription (String groupId, String changedDescription) throws HyphenateException
 
void asyncChangeGroupDescription (final String groupId, final String changedDescription, final EMCallBack callBack)
 
EMGroup acceptInvitation (String groupId, String inviter) throws HyphenateException
 
void asyncAcceptInvitation (final String groupId, final String inviter, final EMValueCallBack< EMGroup > callback)
 
void declineInvitation (String groupId, String inviter, String reason) throws HyphenateException
 
void asyncDeclineInvitation (final String groupId, final String inviter, final String reason, final EMCallBack callback)
 
void acceptApplication (String username, String groupId) throws HyphenateException
 
void asyncAcceptApplication (final String username, final String groupId, final EMCallBack callback)
 
void declineApplication (String username, String groupId, String reason) throws HyphenateException
 
void asyncDeclineApplication (final String username, final String groupId, final String reason, final EMCallBack callback)
 
void inviteUser (String groupId, String[] beInvitedUsernames, String reason) throws HyphenateException
 
void asyncInviteUser (final String groupId, final String[] beInvitedUsernames, final String reason, final EMCallBack callback)
 
void applyJoinToGroup (String groupId, String reason) throws HyphenateException
 
void asyncApplyJoinToGroup (final String groupId, final String reason, final EMCallBack callback)
 
void blockGroupMessage (String groupId) throws HyphenateException
 
void asyncBlockGroupMessage (final String groupId, final EMCallBack callback)
 
void unblockGroupMessage (String groupId) throws HyphenateException
 
void asyncUnblockGroupMessage (final String groupId, final EMCallBack callback)
 
void blockUser (String groupId, String username) throws HyphenateException
 
void asyncBlockUser (final String groupId, final String username, final EMCallBack callback)
 
void blockUsers (String groupId, List< String > members) throws HyphenateException
 
void asyncBlockUsers (final String groupId, final List< String > members, final EMCallBack callback)
 
void unblockUser (String groupId, String username) throws HyphenateException
 
void asyncUnblockUser (final String groupId, final String username, final EMCallBack callback)
 
void unblockUsers (String groupId, List< String > members) throws HyphenateException
 
void asyncUnblockUsers (final String groupId, final List< String > members, final EMCallBack callback)
 
List< String > getBlockedUsers (String groupId) throws HyphenateException
 
List< String > getBlockedUsers (String groupId, int pageIndex, int pageSize) throws HyphenateException
 
void asyncGetBlockedUsers (final String groupId, final EMValueCallBack< List< String > > callback)
 
void asyncGetBlockedUsers (final String groupId, final int pageIndex, final int pageSize, final EMValueCallBack< List< String > > callback)
 
void addGroupChangeListener (EMGroupChangeListener listener)
 
void removeGroupChangeListener (EMGroupChangeListener listener)
 
EMCursorResult< String > fetchGroupMembers (String groupId, String cursor, int pageSize) throws HyphenateException
 
void asyncFetchGroupMembers (final String groupId, final String cursor, final int pageSize, final EMValueCallBack< EMCursorResult< String > > callback)
 
EMGroup changeOwner (String groupId, String newOwner) throws HyphenateException
 
void asyncChangeOwner (final String groupId, final String newOwner, final EMValueCallBack< EMGroup > callback)
 
EMGroup addGroupAdmin (final String groupId, final String admin) throws HyphenateException
 
void asyncAddGroupAdmin (final String groupId, final String admin, final EMValueCallBack< EMGroup > callback)
 
EMGroup removeGroupAdmin (String groupId, String admin) throws HyphenateException
 
void asyncRemoveGroupAdmin (final String groupId, final String admin, final EMValueCallBack< EMGroup > callback)
 
EMGroup muteGroupMembers (String groupId, List< String > muteMembers, long duration) throws HyphenateException
 
void asyncMuteGroupMembers (final String groupId, final List< String > muteMembers, final long duration, final EMValueCallBack< EMGroup > callback)
 
EMGroup unMuteGroupMembers (String groupId, List< String > members) throws HyphenateException
 
void asyncUnMuteGroupMembers (final String groupId, final List< String > members, final EMValueCallBack< EMGroup > callback)
 
Map< String, Long > fetchGroupMuteList (String groupId, int pageNum, int pageSize) throws HyphenateException
 
void asyncFetchGroupMuteList (final String groupId, final int pageNum, final int pageSize, final EMValueCallBack< Map< String, Long > > callBack)
 
List< String > fetchGroupBlackList (String groupId, int pageNum, int pageSize) throws HyphenateException
 
void asyncFetchGroupBlackList (final String groupId, final int pageNum, final int pageSize, final EMValueCallBack< List< String > > callBack)
 
void addToGroupWhiteList (final String groupId, final List< String > members, final EMCallBack callBack)
 
void removeFromGroupWhiteList (final String groupId, final List< String > members, final EMCallBack callBack)
 
void checkIfInGroupWhiteList (final String groupId, EMValueCallBack< Boolean > callBack)
 
void fetchGroupWhiteList (final String groupId, final EMValueCallBack< List< String > > callBack)
 
void muteAllMembers (final String groupId, final EMValueCallBack< EMGroup > callBack)
 
void unmuteAllMembers (final String groupId, final EMValueCallBack< EMGroup > callBack)
 
void updateGroupAnnouncement (String groupId, String announcement) throws HyphenateException
 
void asyncUpdateGroupAnnouncement (final String groupId, final String announcement, final EMCallBack callBack)
 
String fetchGroupAnnouncement (String groupId) throws HyphenateException
 
void asyncFetchGroupAnnouncement (final String groupId, final EMValueCallBack< String > callBack)
 
EMMucSharedFile uploadGroupSharedFile (String groupId, String filePath, EMCallBack callBack) throws HyphenateException
 
void asyncUploadGroupSharedFile (final String groupId, final String filePath, final EMCallBack callBack)
 
void asyncUploadGroupSharedFile (final String groupId, final String filePath, final EMValueCallBack< EMMucSharedFile > callBack)
 
List< EMMucSharedFilefetchGroupSharedFileList (String groupId, int pageNum, int pageSize) throws HyphenateException
 
void asyncFetchGroupSharedFileList (final String groupId, final int pageNum, final int pageSize, final EMValueCallBack< List< EMMucSharedFile > > callBack)
 
void deleteGroupSharedFile (String groupId, String fileId) throws HyphenateException
 
void asyncDeleteGroupSharedFile (final String groupId, final String fileId, final EMCallBack callBack)
 
void downloadGroupSharedFile (String groupId, String fileId, String savePath, EMCallBack callBack) throws HyphenateException
 
void asyncDownloadGroupSharedFile (final String groupId, final String fileId, final String savePath, final EMCallBack callBack)
 
void asyncSetGroupMemberAttributes (String groupId, String userId, Map< String, String > attributeMap, EMCallBack callBack)
 
void asyncFetchGroupMemberAllAttributes (String groupId, String userId, EMValueCallBack< Map< String, Map< String, String > > > callBack)
 
void asyncFetchGroupMembersAttributes (String groupId, List< String > userList, List< String > keyList, EMValueCallBack< Map< String, Map< String, String > > > callBack)
 
EMGroup updateGroupExtension (String groupId, String extension) throws HyphenateException
 
void cleanAllGroupsFromLocal ()
 

Detailed Description

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

Member Function Documentation

◆ acceptApplication()

void com.hyphenate.chat.EMGroupManager.acceptApplication ( String  username,
String  groupId 
) throws HyphenateException

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

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
HyphenateExceptionA description of the exception. See EMError.

◆ acceptInvitation()

EMGroup com.hyphenate.chat.EMGroupManager.acceptInvitation ( String  groupId,
String  inviter 
) throws HyphenateException

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

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
HyphenateExceptionA description of the exception. see EMError.

◆ addGroupAdmin()

EMGroup com.hyphenate.chat.EMGroupManager.addGroupAdmin ( final String  groupId,
final String  admin 
) throws HyphenateException

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

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
HyphenateExceptionA description of the exception. See EMError.

◆ addGroupChangeListener()

void com.hyphenate.chat.EMGroupManager.addGroupChangeListener ( EMGroupChangeListener  listener)

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

Parameters
listenerThe group event listener to be registered.

◆ addToGroupWhiteList()

void com.hyphenate.chat.EMGroupManager.addToGroupWhiteList ( final String  groupId,
final List< String >  members,
final EMCallBack  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 EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ addUsersToGroup() [1/2]

void com.hyphenate.chat.EMGroupManager.addUsersToGroup ( String  groupId,
String[]  newmembers 
) throws HyphenateException

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

This is a synchronous method and blocks the current thread.

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

◆ addUsersToGroup() [2/2]

void com.hyphenate.chat.EMGroupManager.addUsersToGroup ( String  groupId,
String[]  newmembers,
String  welcomeMessage 
) throws HyphenateException

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

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
HyphenateExceptionA description of the exception. See EMError.

◆ applyJoinToGroup()

void com.hyphenate.chat.EMGroupManager.applyJoinToGroup ( String  groupId,
String  reason 
) throws HyphenateException

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

This is a synchronous method and blocks the current thread.

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

◆ asyncAcceptApplication()

void com.hyphenate.chat.EMGroupManager.asyncAcceptApplication ( final String  username,
final String  groupId,
final EMCallBack  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 EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String) if it does not.

◆ asyncAcceptInvitation()

void com.hyphenate.chat.EMGroupManager.asyncAcceptInvitation ( final String  groupId,
final String  inviter,
final EMValueCallBack< EMGroup 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 EMValueCallBack#onSuccess(Object) and returns the updated group instance; if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncAddGroupAdmin()

void com.hyphenate.chat.EMGroupManager.asyncAddGroupAdmin ( final String  groupId,
final String  admin,
final EMValueCallBack< EMGroup 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 EMValueCallBack#onSuccess(Object) and returns the updated group instance; If this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncAddUsersToGroup()

void com.hyphenate.chat.EMGroupManager.asyncAddUsersToGroup ( final String  groupId,
final String[]  newmembers,
final EMCallBack  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 EMCallBack#onSuccess(); If this call fails, calls EMCallBack#onError(int, String).

◆ asyncApplyJoinToGroup()

void com.hyphenate.chat.EMGroupManager.asyncApplyJoinToGroup ( final String  groupId,
final String  reason,
final EMCallBack  callback 
)

Requests to join a group. Note: The group style is EMGroupStyle#EMGroupStylePublicJoinNeedApproval, 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 EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncBlockGroupMessage()

void com.hyphenate.chat.EMGroupManager.asyncBlockGroupMessage ( final String  groupId,
final EMCallBack  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 EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncBlockUser()

void com.hyphenate.chat.EMGroupManager.asyncBlockUser ( final String  groupId,
final String  username,
final EMCallBack  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 EMCallBack#onSuccess(); If this call fails, calls EMCallBack#onError(int, String).

◆ asyncBlockUsers()

void com.hyphenate.chat.EMGroupManager.asyncBlockUsers ( final String  groupId,
final List< String >  members,
final EMCallBack  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 EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncChangeGroupDescription()

void com.hyphenate.chat.EMGroupManager.asyncChangeGroupDescription ( final String  groupId,
final String  changedDescription,
final EMCallBack  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 EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncChangeGroupName()

void com.hyphenate.chat.EMGroupManager.asyncChangeGroupName ( final String  groupId,
final String  changedGroupName,
final EMCallBack  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 EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncChangeOwner()

void com.hyphenate.chat.EMGroupManager.asyncChangeOwner ( final String  groupId,
final String  newOwner,
final EMValueCallBack< EMGroup 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 EMValueCallBack#onSuccess(Object) and returns the updated group instance; if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncCreateGroup()

void com.hyphenate.chat.EMGroupManager.asyncCreateGroup ( final String  groupName,
final String  desc,
final String[]  allMembers,
final String  reason,
final EMGroupOptions  option,
final EMValueCallBack< EMGroup 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 com.hyphenate.EMMultiDeviceListener to listen on the event. The event callback function is com.hyphenate.EMMultiDeviceListener#onGroupEvent(int, String, List), where the first parameter is the event, for example, com.hyphenate.EMMultiDeviceListener#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 EMGroupOptions. The options are as follows:
  • The maximum number of group members. The default value is 200.
  • The group style. See EMGroupStyle. The default value is EMGroupStyle#EMGroupStylePrivateOnlyOwnerInvite.
  • 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 EMValueCallBack#onSuccess(Object) and returns the created group object; If this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncDeclineApplication()

void com.hyphenate.chat.EMGroupManager.asyncDeclineApplication ( final String  username,
final String  groupId,
final String  reason,
final EMCallBack  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 to join the group.
groupIdThe group ID.
reasonThe reason of declining.
callbackThe completion callback. If this call succeeds, calls EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncDeclineInvitation()

void com.hyphenate.chat.EMGroupManager.asyncDeclineInvitation ( final String  groupId,
final String  inviter,
final String  reason,
final EMCallBack  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 EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncDeleteGroupSharedFile()

void com.hyphenate.chat.EMGroupManager.asyncDeleteGroupSharedFile ( final String  groupId,
final String  fileId,
final EMCallBack  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 EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncDestroyGroup()

void com.hyphenate.chat.EMGroupManager.asyncDestroyGroup ( final String  groupId,
final EMCallBack  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 EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncDownloadGroupSharedFile()

void com.hyphenate.chat.EMGroupManager.asyncDownloadGroupSharedFile ( final String  groupId,
final String  fileId,
final String  savePath,
final EMCallBack  callBack 
)

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

This is an asynchronous method.

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

◆ asyncFetchGroupAnnouncement()

void com.hyphenate.chat.EMGroupManager.asyncFetchGroupAnnouncement ( final String  groupId,
final EMValueCallBack< 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 EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncFetchGroupBlackList()

void com.hyphenate.chat.EMGroupManager.asyncFetchGroupBlackList ( final String  groupId,
final int  pageNum,
final int  pageSize,
final EMValueCallBack< 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 EMValueCallBack#onSuccess(Object) and returns the group blocklist on the next page; if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncFetchGroupMemberAllAttributes()

void com.hyphenate.chat.EMGroupManager.asyncFetchGroupMemberAllAttributes ( String  groupId,
String  userId,
EMValueCallBack< Map< String, Map< String, String > > >  callBack 
)

Gets all custom attributes of a group member.

Parameters
groupIdThe group ID.
userIdThe user ID of the group member whose all custom attributes are retrieved.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncFetchGroupMembers()

void com.hyphenate.chat.EMGroupManager.asyncFetchGroupMembers ( final String  groupId,
final String  cursor,
final int  pageSize,
final EMValueCallBack< EMCursorResult< 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 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.
callbackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object) and returns the result of EMCursorResult, 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 EMValueCallBack#onError(int, String).

◆ asyncFetchGroupMembersAttributes()

void com.hyphenate.chat.EMGroupManager.asyncFetchGroupMembersAttributes ( String  groupId,
List< String >  userList,
List< String >  keyList,
EMValueCallBack< Map< String, Map< String, String > > >  callBack 
)

Gets custom attributes of multiple group members by attribute key.

Parameters
groupIdThe group ID.
userListThe array of user IDs of group members whose custom attributes are retrieved.
keyListThe array of keys of custom attributes to be retrieved. If you pass in an empty array or do not set this parameter, the SDK gets all custom attributes of these group members.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncFetchGroupMuteList()

void com.hyphenate.chat.EMGroupManager.asyncFetchGroupMuteList ( final String  groupId,
final int  pageNum,
final int  pageSize,
final EMValueCallBack< 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 EMValueCallBack#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 EMValueCallBack#onError(int, String).

◆ asyncFetchGroupSharedFileList()

void com.hyphenate.chat.EMGroupManager.asyncFetchGroupSharedFileList ( final String  groupId,
final int  pageNum,
final int  pageSize,
final EMValueCallBack< List< EMMucSharedFile > >  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 EMValueCallBack#onSuccess(Object) and returns the shared files; if this call fails, calls EMValueCallBack#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 com.hyphenate.chat.EMGroupManager.asyncGetBlockedUsers ( final String  groupId,
final EMValueCallBack< 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 EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncGetBlockedUsers() [2/2]

void com.hyphenate.chat.EMGroupManager.asyncGetBlockedUsers ( final String  groupId,
final int  pageIndex,
final int  pageSize,
final EMValueCallBack< 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 EMValueCallBack#onSuccess(Object) and returns the group blocklist; if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncGetGroupFromServer()

void com.hyphenate.chat.EMGroupManager.asyncGetGroupFromServer ( final String  groupId,
final EMValueCallBack< EMGroup 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 EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncGetJoinedGroupsCountFromServer()

void com.hyphenate.chat.EMGroupManager.asyncGetJoinedGroupsCountFromServer ( final EMValueCallBack< Integer >  callback)

Gets groups count of the current user joined from the server.

This is an asynchronous method.

Parameters
callbackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object) and returns the group count if this call fails, calls EMValueCallBack#onError(int, String);

◆ asyncGetJoinedGroupsFromServer() [1/3]

void com.hyphenate.chat.EMGroupManager.asyncGetJoinedGroupsFromServer ( final EMValueCallBack< List< EMGroup > >  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 EMValueCallBack#onSuccess(Object) and returns the list of groups that the user has joined; if the call fails, calls EMValueCallBack#onError(int, String).
Deprecated:
Deprecated. Use asyncGetJoinedGroupsFromServer(int, int, boolean, boolean, EMValueCallBack) instead.

◆ asyncGetJoinedGroupsFromServer() [2/3]

void com.hyphenate.chat.EMGroupManager.asyncGetJoinedGroupsFromServer ( final int  pageIndex,
final int  pageSize,
boolean  needMemberCount,
boolean  needRole,
final EMValueCallBack< List< EMGroup > >  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 EMValueCallBack#onSuccess(Object) and returns the group list on the next page; if this call fails, calls EMValueCallBack#onError(int, String);

◆ asyncGetJoinedGroupsFromServer() [3/3]

void com.hyphenate.chat.EMGroupManager.asyncGetJoinedGroupsFromServer ( final int  pageIndex,
final int  pageSize,
final EMValueCallBack< List< EMGroup > >  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 EMValueCallBack#onSuccess(Object) and returns the group list on the next page; if this call fails, calls EMValueCallBack#onError(int, String);
Deprecated:
Deprecated. Please use asyncGetJoinedGroupsFromServer(int, int, boolean, boolean, EMValueCallBack) instead.

◆ asyncGetPublicGroupsFromServer()

void com.hyphenate.chat.EMGroupManager.asyncGetPublicGroupsFromServer ( final int  pageSize,
final String  cursor,
final EMValueCallBack< EMCursorResult< EMGroupInfo > >  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 EMValueCallBack#onSuccess(Object) and returns the result of EMCursorResult), 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 EMValueCallBack#onError(int, String).

◆ asyncInviteUser()

void com.hyphenate.chat.EMGroupManager.asyncInviteUser ( final String  groupId,
final String[]  beInvitedUsernames,
final String  reason,
final EMCallBack  callback 
)

Invites users to join a group. Note: The group style is EMGroupStyle#EMGroupStylePrivateMemberCanInvite, 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 EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncJoinGroup()

void com.hyphenate.chat.EMGroupManager.asyncJoinGroup ( final String  groupId,
final EMCallBack  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 EMGroupStyle. For the synchronous method, see joinGroup(String).

This is an asynchronous method.

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

◆ asyncLeaveGroup()

void com.hyphenate.chat.EMGroupManager.asyncLeaveGroup ( final String  groupId,
final EMCallBack  callback 
)

Leaves a group.

This is an asynchronous method.

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

◆ asyncMuteGroupMembers()

void com.hyphenate.chat.EMGroupManager.asyncMuteGroupMembers ( final String  groupId,
final List< String >  muteMembers,
final long  duration,
final EMValueCallBack< EMGroup 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. The value -1 indicates that the members are muted permanently.
callbackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object) and returns the updated group instance; If this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncRemoveGroupAdmin()

void com.hyphenate.chat.EMGroupManager.asyncRemoveGroupAdmin ( final String  groupId,
final String  admin,
final EMValueCallBack< EMGroup 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 EMValueCallBack#onSuccess(Object) and returns the updated group instance; if this call succeeds, calls EMValueCallBack#onError(int, String).

◆ asyncRemoveUserFromGroup()

void com.hyphenate.chat.EMGroupManager.asyncRemoveUserFromGroup ( final String  groupId,
final String  username,
final EMCallBack  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 EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncRemoveUsersFromGroup()

void com.hyphenate.chat.EMGroupManager.asyncRemoveUsersFromGroup ( final String  groupId,
final List< String >  members,
final EMCallBack  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 EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncSetGroupMemberAttributes()

void com.hyphenate.chat.EMGroupManager.asyncSetGroupMemberAttributes ( String  groupId,
String  userId,
Map< String, String >  attributeMap,
EMCallBack  callBack 
)

Sets custom attributes of a group member.

Parameters
groupIdThe group ID.
userIdThe user ID of the group member for whom the custom attributes are set.
attributeMapThe map of custom attributes in key-value format. In a key-value pair, if the value is set to an empty string, the custom attribute will be deleted.
callBackThe completion callback. If this call succeeds, calls EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncUnblockGroupMessage()

void com.hyphenate.chat.EMGroupManager.asyncUnblockGroupMessage ( final String  groupId,
final EMCallBack  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 EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncUnblockUser()

void com.hyphenate.chat.EMGroupManager.asyncUnblockUser ( final String  groupId,
final String  username,
final EMCallBack  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 EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncUnblockUsers()

void com.hyphenate.chat.EMGroupManager.asyncUnblockUsers ( final String  groupId,
final List< String >  members,
final EMCallBack  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 EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncUnMuteGroupMembers()

void com.hyphenate.chat.EMGroupManager.asyncUnMuteGroupMembers ( final String  groupId,
final List< String >  members,
final EMValueCallBack< EMGroup 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 EMValueCallBack#onSuccess(Object) and returns the updated group instance; if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncUpdateGroupAnnouncement()

void com.hyphenate.chat.EMGroupManager.asyncUpdateGroupAnnouncement ( final String  groupId,
final String  announcement,
final EMCallBack  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 EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncUploadGroupSharedFile() [1/2]

void com.hyphenate.chat.EMGroupManager.asyncUploadGroupSharedFile ( final String  groupId,
final String  filePath,
final EMCallBack  callBack 
)

Uploads the shared file to the group.

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

This is an asynchronous method.

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

◆ asyncUploadGroupSharedFile() [2/2]

void com.hyphenate.chat.EMGroupManager.asyncUploadGroupSharedFile ( final String  groupId,
final String  filePath,
final EMValueCallBack< EMMucSharedFile callBack 
)

Uploads the shared file to the group.

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

This is an asynchronous method.

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

◆ blockGroupMessage()

void com.hyphenate.chat.EMGroupManager.blockGroupMessage ( String  groupId) throws HyphenateException

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, EMCallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ blockUser()

void com.hyphenate.chat.EMGroupManager.blockUser ( String  groupId,
String  username 
) throws HyphenateException

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, EMCallBack).

This is a synchronous method and blocks the current thread.

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

◆ blockUsers()

void com.hyphenate.chat.EMGroupManager.blockUsers ( String  groupId,
List< String >  members 
) throws HyphenateException

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, EMCallBack).

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
HyphenateExceptionA description of the exception. See EMError.

◆ changeGroupDescription()

void com.hyphenate.chat.EMGroupManager.changeGroupDescription ( String  groupId,
String  changedDescription 
) throws HyphenateException

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

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
changedDescriptionThe new group description.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ changeGroupName()

void com.hyphenate.chat.EMGroupManager.changeGroupName ( String  groupId,
String  changedGroupName 
) throws HyphenateException

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

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
HyphenateExceptionA description of the exception. See EMError.

◆ changeOwner()

EMGroup com.hyphenate.chat.EMGroupManager.changeOwner ( String  groupId,
String  newOwner 
) throws HyphenateException

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

This is a synchronous method and blocks the current thread.

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

◆ checkIfInGroupWhiteList()

void com.hyphenate.chat.EMGroupManager.checkIfInGroupWhiteList ( final String  groupId,
EMValueCallBack< 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 EMValueCallBack#onSuccess(Object) and returns a Boolean value to indicate whether the current user is on the group blocklist; if this call fails, calls EMValueCallBack#onError(int, String).

◆ cleanAllGroupsFromLocal()

void com.hyphenate.chat.EMGroupManager.cleanAllGroupsFromLocal ( )

Clear all local group details from the database and memory.

◆ createGroup()

EMGroup com.hyphenate.chat.EMGroupManager.createGroup ( String  groupName,
String  desc,
String[]  allMembers,
String  reason,
EMGroupOptions  option 
) throws HyphenateException

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 com.hyphenate.EMMultiDeviceListener to listen on the event. The event callback function is com.hyphenate.EMMultiDeviceListener#onGroupEvent(int, String, List), where the first parameter is the event, for example, com.hyphenate.EMMultiDeviceListener#GROUP_CREATE for the group creation event. For the asynchronous method, see asyncCreateGroup(String, String, String[], String, EMGroupOptions, EMValueCallBack).

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 EMGroupOptions. The options are as follows:
  • The maximum number of group members. The default value is 200.
  • The group style. See EMGroupStyle. The default value is EMGroupStyle#EMGroupStylePrivateOnlyOwnerInvite.
  • 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
HyphenateExceptionA description of the exception. See EMError.

◆ declineApplication()

void com.hyphenate.chat.EMGroupManager.declineApplication ( String  username,
String  groupId,
String  reason 
) throws HyphenateException

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

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
HyphenateExceptionA description of the exception. See EMError.

◆ declineInvitation()

void com.hyphenate.chat.EMGroupManager.declineInvitation ( String  groupId,
String  inviter,
String  reason 
) throws HyphenateException

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

This is a synchronous method and blocks the current thread.

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

◆ deleteGroupSharedFile()

void com.hyphenate.chat.EMGroupManager.deleteGroupSharedFile ( String  groupId,
String  fileId 
) throws HyphenateException

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, EMCallBack).

This is a synchronous method and blocks the current thread.

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

◆ destroyGroup()

void com.hyphenate.chat.EMGroupManager.destroyGroup ( final String  groupId) throws HyphenateException

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

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ downloadGroupSharedFile()

void com.hyphenate.chat.EMGroupManager.downloadGroupSharedFile ( String  groupId,
String  fileId,
String  savePath,
EMCallBack  callBack 
) throws HyphenateException

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, EMCallBack).

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
HyphenateExceptionA description of the exception. See EMError.

◆ fetchGroupAnnouncement()

String com.hyphenate.chat.EMGroupManager.fetchGroupAnnouncement ( String  groupId) throws HyphenateException

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

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
Returns
The group announcement.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ fetchGroupBlackList()

List< String > com.hyphenate.chat.EMGroupManager.fetchGroupBlackList ( String  groupId,
int  pageNum,
int  pageSize 
) throws HyphenateException

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, EMValueCallBack).

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
HyphenateExceptionA description of the exception. See EMError.

◆ fetchGroupMembers()

EMCursorResult< String > com.hyphenate.chat.EMGroupManager.fetchGroupMembers ( String  groupId,
String  cursor,
int  pageSize 
) throws HyphenateException

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

Synchronization method will block the current thread.

For example:

EMCursorResult result = fetchGroupMembers(groupId, cursor, pageSize); // search 1
result = fetchGroupMembers(groupId, result.getCursor(), pageSize); // search 2
EMCursorResult< String > fetchGroupMembers(String groupId, String cursor, int pageSize)
Definition: EMGroupManager.java:2980
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 EMCursorResult, 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
HyphenateExceptionA description of the exception. See EMError

◆ fetchGroupMuteList()

Map< String, Long > com.hyphenate.chat.EMGroupManager.fetchGroupMuteList ( String  groupId,
int  pageNum,
int  pageSize 
) throws HyphenateException

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, EMValueCallBack).

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
HyphenateExceptionA description of the exception. See EMError.

◆ fetchGroupSharedFileList()

List< EMMucSharedFile > com.hyphenate.chat.EMGroupManager.fetchGroupSharedFileList ( String  groupId,
int  pageNum,
int  pageSize 
) throws HyphenateException

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

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
HyphenateExceptionA description of the exception. See EMError.

◆ fetchGroupWhiteList()

void com.hyphenate.chat.EMGroupManager.fetchGroupWhiteList ( final String  groupId,
final EMValueCallBack< 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 EMValueCallBack#onSuccess(Object) and return the group blocklist; if this call fails, calls EMValueCallBack#onError(int, String).

◆ getAllGroups()

List< EMGroup > com.hyphenate.chat.EMGroupManager.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 > com.hyphenate.chat.EMGroupManager.getBlockedUsers ( String  groupId) throws HyphenateException

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, EMValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
Returns
List The group blocklist.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ getBlockedUsers() [2/2]

List< String > com.hyphenate.chat.EMGroupManager.getBlockedUsers ( String  groupId,
int  pageIndex,
int  pageSize 
) throws HyphenateException

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, EMValueCallBack).

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
HyphenateExceptionA description of the exception. See EMError.

◆ getGroup()

EMGroup com.hyphenate.chat.EMGroupManager.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]

EMGroup com.hyphenate.chat.EMGroupManager.getGroupFromServer ( String  groupId) throws HyphenateException

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, EMValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
Returns
EMGroup The group instance.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ getGroupFromServer() [2/2]

EMGroup com.hyphenate.chat.EMGroupManager.getGroupFromServer ( String  groupId,
boolean  fetchMembers 
) throws HyphenateException

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
EMGroup The updated group instance.
Exceptions
HyphenateExceptionA description of the exception. See EMError.
Deprecated:
This method is deprecated. Use getGroupFromServer(String) instead.

◆ getJoinedGroupsFromServer() [1/3]

synchronized List< EMGroup > com.hyphenate.chat.EMGroupManager.getJoinedGroupsFromServer ( ) throws HyphenateException

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(EMValueCallBack).

This is a synchronous method and blocks the current thread.

Returns
The list of groups that the current user joins.
Exceptions
HyphenateExceptionA description of the exception. See EMError.
Deprecated:
Deprecated. Please use getJoinedGroupsFromServer(int, int, boolean, boolean) instead.

◆ getJoinedGroupsFromServer() [2/3]

synchronized List< EMGroup > com.hyphenate.chat.EMGroupManager.getJoinedGroupsFromServer ( int  pageIndex,
int  pageSize 
) throws HyphenateException

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, EMValueCallBack).

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
HyphenateExceptionA description of the exception. See EMError.
Deprecated:
Deprecated. Please use getJoinedGroupsFromServer(int, int, boolean, boolean) instead.

◆ getJoinedGroupsFromServer() [3/3]

synchronized List< EMGroup > com.hyphenate.chat.EMGroupManager.getJoinedGroupsFromServer ( int  pageIndex,
int  pageSize,
boolean  needMemberCount,
boolean  needRole 
) throws HyphenateException

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, EMValueCallBack).

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
HyphenateExceptionA description of the exception. See EMError.

◆ getPublicGroupsFromServer()

EMCursorResult< EMGroupInfo > com.hyphenate.chat.EMGroupManager.getPublicGroupsFromServer ( int  pageSize,
String  cursor 
) throws HyphenateException

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

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 EMCursorResult, 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
HyphenateExceptionA description of the exception. See EMError.

◆ inviteUser()

void com.hyphenate.chat.EMGroupManager.inviteUser ( String  groupId,
String[]  beInvitedUsernames,
String  reason 
) throws HyphenateException

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

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
HyphenateExceptionA description of the exception. See EMError.

◆ joinGroup()

void com.hyphenate.chat.EMGroupManager.joinGroup ( String  groupId) throws HyphenateException

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 EMGroupStyle. For the asynchronous method, see asyncJoinGroup(String, EMCallBack).

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ leaveGroup()

void com.hyphenate.chat.EMGroupManager.leaveGroup ( String  groupId) throws HyphenateException

Leaves a group.

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ loadAllGroups()

synchronized void com.hyphenate.chat.EMGroupManager.loadAllGroups ( )

Loads all local groups from the database.

◆ muteAllMembers()

void com.hyphenate.chat.EMGroupManager.muteAllMembers ( final String  groupId,
final EMValueCallBack< EMGroup 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 EMValueCallBack#onSuccess(Object) and returns the updated group instance; if this call fails, calls EMValueCallBack#onError(int, String).

◆ muteGroupMembers()

EMGroup com.hyphenate.chat.EMGroupManager.muteGroupMembers ( String  groupId,
List< String >  muteMembers,
long  duration 
) throws HyphenateException

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

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. The value -1 indicates that the members are muted permanently.
Returns
The updated group instance.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ removeFromGroupWhiteList()

void com.hyphenate.chat.EMGroupManager.removeFromGroupWhiteList ( final String  groupId,
final List< String >  members,
final EMCallBack  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 EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ removeGroupAdmin()

EMGroup com.hyphenate.chat.EMGroupManager.removeGroupAdmin ( String  groupId,
String  admin 
) throws HyphenateException

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

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
HyphenateExceptionA description of the exception. See EMError.

◆ removeGroupChangeListener()

void com.hyphenate.chat.EMGroupManager.removeGroupChangeListener ( EMGroupChangeListener  listener)

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

Parameters
listenerThe group event listener to be removed.

◆ removeUserFromGroup()

void com.hyphenate.chat.EMGroupManager.removeUserFromGroup ( final String  groupId,
final String  username 
) throws HyphenateException

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

This is a synchronous method and blocks the current thread.

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

◆ removeUsersFromGroup()

void com.hyphenate.chat.EMGroupManager.removeUsersFromGroup ( final String  groupId,
final List< String >  members 
) throws HyphenateException

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
HyphenateExceptionA description of the exception. See EMError.

◆ unblockGroupMessage()

void com.hyphenate.chat.EMGroupManager.unblockGroupMessage ( String  groupId) throws HyphenateException

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

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ unblockUser()

void com.hyphenate.chat.EMGroupManager.unblockUser ( String  groupId,
String  username 
) throws HyphenateException

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, EMCallBack).

This is a synchronous method and blocks the current thread.

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

◆ unblockUsers()

void com.hyphenate.chat.EMGroupManager.unblockUsers ( String  groupId,
List< String >  members 
) throws HyphenateException

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

This is a synchronous method and blocks the current thread.

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

◆ unmuteAllMembers()

void com.hyphenate.chat.EMGroupManager.unmuteAllMembers ( final String  groupId,
final EMValueCallBack< EMGroup 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 EMValueCallBack#onSuccess(Object) and returns the updated group instance; if this call fails, calls EMValueCallBack#onError(int, String).

◆ unMuteGroupMembers()

EMGroup com.hyphenate.chat.EMGroupManager.unMuteGroupMembers ( String  groupId,
List< String >  members 
) throws HyphenateException

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

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
HyphenateExceptionA description of the exception. See EMError.

◆ updateGroupAnnouncement()

void com.hyphenate.chat.EMGroupManager.updateGroupAnnouncement ( String  groupId,
String  announcement 
) throws HyphenateException

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

This is a synchronous method and blocks the current thread.

Parameters
groupIdThe group ID.
announcementThe group announcement.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ updateGroupExtension()

EMGroup com.hyphenate.chat.EMGroupManager.updateGroupExtension ( String  groupId,
String  extension 
) throws HyphenateException

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
HyphenateExceptionA description of the exception. See EMError.

◆ uploadGroupSharedFile()

EMMucSharedFile com.hyphenate.chat.EMGroupManager.uploadGroupSharedFile ( String  groupId,
String  filePath,
EMCallBack  callBack 
) throws HyphenateException

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

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
HyphenateExceptionA description of the exception. See EMError.

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