hyphenate_SDK4.0 5.0.0
hyphenate java IM SDK
 
Loading...
Searching...
No Matches
com.hyphenate.chat.EMChatRoomManager Class Reference

Public Member Functions

void addChatRoomChangeListener (EMChatRoomChangeListener listener)
 
void removeChatRoomChangeListener (EMChatRoomChangeListener listener)
 
void joinChatRoom (final String roomId, final EMValueCallBack< EMChatRoom > callback)
 
void joinChatRoom (final String roomId, boolean leaveOtherRooms, String ext, final EMValueCallBack< EMChatRoom > callback)
 
void leaveChatRoom (final String roomId)
 
void leaveChatRoom (final String roomId, EMCallBack callback)
 
EMPageResult< EMChatRoomfetchPublicChatRoomsFromServer (int pageNum, int pageSize) throws HyphenateException
 
void asyncFetchPublicChatRoomsFromServer (final int pageNum, final int pageSize, final EMValueCallBack< EMPageResult< EMChatRoom > > callback)
 
EMChatRoom fetchChatRoomFromServer (String roomId) throws HyphenateException
 
void asyncFetchChatRoomFromServer (final String roomId, final EMValueCallBack< EMChatRoom > callback)
 
EMChatRoom getChatRoom (String roomId)
 
EMChatRoom changeChatRoomSubject (String chatRoomId, String newSubject) throws HyphenateException
 
void asyncChangeChatRoomSubject (final String chatRoomId, final String newSubject, final EMValueCallBack< EMChatRoom > callBack)
 
EMChatRoom changeChatroomDescription (String chatRoomId, String newDescription) throws HyphenateException
 
void asyncChangeChatroomDescription (final String chatRoomId, final String newDescription, final EMValueCallBack< EMChatRoom > callBack)
 
EMCursorResult< String > fetchChatRoomMembers (String chatRoomId, String cursor, int pageSize) throws HyphenateException
 
void asyncFetchChatRoomMembers (final String chatRoomId, final String cursor, final int pageSize, final EMValueCallBack< EMCursorResult< String > > callBack)
 
EMChatRoom muteChatRoomMembers (String chatRoomId, List< String > muteMembers, long duration) throws HyphenateException
 
void asyncMuteChatRoomMembers (final String chatRoomId, final List< String > muteMembers, final long duration, final EMValueCallBack< EMChatRoom > callBack)
 
EMChatRoom unMuteChatRoomMembers (String chatRoomId, List< String > members) throws HyphenateException
 
void asyncUnMuteChatRoomMembers (final String chatRoomId, final List< String > members, final EMValueCallBack< EMChatRoom > callBack)
 
EMChatRoom changeOwner (String chatRoomId, String newOwner) throws HyphenateException
 
void asyncChangeOwner (final String chatRoomId, final String newOwner, final EMValueCallBack< EMChatRoom > callBack) throws HyphenateException
 
EMChatRoom addChatRoomAdmin (String chatRoomId, String admin) throws HyphenateException
 
void asyncAddChatRoomAdmin (final String chatRoomId, final String admin, final EMValueCallBack< EMChatRoom > callBack)
 
EMChatRoom removeChatRoomAdmin (String chatRoomId, String admin) throws HyphenateException
 
void asyncRemoveChatRoomAdmin (final String chatRoomId, final String admin, final EMValueCallBack< EMChatRoom > callBack)
 
Map< String, Long > fetchChatRoomMuteList (String chatRoomId, int pageNum, int pageSize) throws HyphenateException
 
void asyncFetchChatRoomMuteList (final String chatRoomId, final int pageNum, final int pageSize, final EMValueCallBack< Map< String, Long > > callBack)
 
EMChatRoom removeChatRoomMembers (String chatRoomId, List< String > members) throws HyphenateException
 
void asyncRemoveChatRoomMembers (final String chatRoomId, final List< String > members, final EMValueCallBack< EMChatRoom > callBack)
 
EMChatRoom blockChatroomMembers (String chatRoomId, List< String > members) throws HyphenateException
 
void asyncBlockChatroomMembers (final String chatRoomId, final List< String > members, final EMValueCallBack< EMChatRoom > callBack)
 
EMChatRoom unblockChatRoomMembers (String chatRoomId, List< String > members) throws HyphenateException
 
void asyncUnBlockChatRoomMembers (final String chatRoomId, final List< String > members, final EMValueCallBack< EMChatRoom > callBack)
 
List< String > fetchChatRoomBlackList (String chatRoomId, int pageNum, int pageSize) throws HyphenateException
 
void asyncFetchChatRoomBlackList (final String chatRoomId, final int pageNum, final int pageSize, final EMValueCallBack< List< String > > callBack)
 
void addToChatRoomWhiteList (final String chatRoomId, final List< String > members, final EMValueCallBack< EMChatRoom > callBack)
 
void removeFromChatRoomWhiteList (final String chatRoomId, final List< String > members, final EMValueCallBack< EMChatRoom > callBack)
 
void checkIfInChatRoomWhiteList (final String chatRoomId, EMValueCallBack< Boolean > callBack)
 
void asyncCheckIfInMuteList (final String chatRoomId, EMValueCallBack< Boolean > callBack)
 
void fetchChatRoomWhiteList (final String chatRoomId, final EMValueCallBack< List< String > > callBack)
 
void muteAllMembers (final String chatRoomId, final EMValueCallBack< EMChatRoom > callBack)
 
void unmuteAllMembers (final String chatRoomId, final EMValueCallBack< EMChatRoom > callBack)
 
void updateChatRoomAnnouncement (String chatRoomId, String announcement) throws HyphenateException
 
void asyncUpdateChatRoomAnnouncement (final String chatRoomId, final String announcement, final EMCallBack callBack)
 
String fetchChatRoomAnnouncement (String chatRoomId) throws HyphenateException
 
void asyncFetchChatRoomAnnouncement (final String chatRoomId, final EMValueCallBack< String > callBack)
 
void asyncSetChatroomAttributes (String chatRoomId, Map< String, String > attributeMap, boolean autoDelete, @NonNull final EMResultCallBack< Map< String, Integer > > callBack)
 
void asyncSetChatroomAttribute (String chatRoomId, String key, String value, boolean autoDelete, @NonNull final EMCallBack callBack)
 
void asyncSetChatroomAttributesForced (String chatRoomId, Map< String, String > attributeMap, boolean autoDelete, @NonNull final EMResultCallBack< Map< String, Integer > > callBack)
 
void asyncSetChatroomAttributeForced (String chatRoomId, String key, String value, boolean autoDelete, @NonNull final EMCallBack callBack)
 
void asyncFetchChatroomAttributesFromServer (String chatRoomId, List< String > keyList, @NonNull final EMValueCallBack< Map< String, String > > callBack)
 
void asyncFetchChatRoomAllAttributesFromServer (String chatRoomId, @NonNull final EMValueCallBack< Map< String, String > > callBack)
 
void asyncRemoveChatRoomAttributesFromServer (String chatRoomId, List< String > keyList, @NonNull final EMResultCallBack< Map< String, Integer > > callBack)
 
void asyncRemoveChatRoomAttributeFromServer (String chatRoomId, String key, @NonNull final EMCallBack callBack)
 
void asyncRemoveChatRoomAttributesFromServerForced (String chatRoomId, List< String > keyList, @NonNull final EMResultCallBack< Map< String, Integer > > callBack)
 
void asyncRemoveChatRoomAttributeFromServerForced (String chatRoomId, String key, @NonNull final EMCallBack callBack)
 

Detailed Description

The chat room manager, which manages users joining and existing the chat room and getting the chat room list, and manages member privileges. For example, joining a chat room:

EMClient.getInstance().chatroomManager().joinChatRoom(conversationId, new EMValueCallBack<EMChatRoom>() {
public void onSuccess(EMChatRoom value) {
//Processing logic for successful chat room joining.
}
public void onError(int error, String errorMsg) {
//Processing logic for chat room joining failures.
}
});
Definition EMChatRoom.java:27
void joinChatRoom(final String roomId, final EMValueCallBack< EMChatRoom > callback)
Definition EMChatRoomManager.java:166
Definition EMClient.java:100
Definition EMValueCallBack.java:28

Member Function Documentation

◆ addChatRoomAdmin()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.addChatRoomAdmin ( String chatRoomId,
String admin ) throws HyphenateException

Adds a chat room admin.

Note
Only the chat room owner can call this method.

For the asynchronous method, see asyncAddChatRoomAdmin(String, String, EMValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
chatRoomIdThe chat room ID.
adminThe member to be set as the chat room admin.
Returns
The modified chat room instance.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ addChatRoomChangeListener()

void com.hyphenate.chat.EMChatRoomManager.addChatRoomChangeListener ( EMChatRoomChangeListener listener)

Adds a chat room event listener.

Note
Chat room destruction, member entry and exit, mute, and allow list changes among other chat room operations can be listened for by setting EMChatRoomChangeListener.

Chat room event listeners added with this method can be removed by calling removeChatRoomChangeListener(EMChatRoomChangeListener).

Parameters
listenerA chat room event listener. See EMChatRoomChangeListener.

◆ addToChatRoomWhiteList()

void com.hyphenate.chat.EMChatRoomManager.addToChatRoomWhiteList ( final String chatRoomId,
final List< String > members,
final EMValueCallBack< EMChatRoom > callBack )

Adds members to the allow list of the chat room.

Note
Only the chat room owner or admin can call this method.

When muteAllMembers(String, EMValueCallBack) executed by the chat room owner or admin, does not work for members on the allow list.

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
membersThe list of members to be added to the allowlist.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncAddChatRoomAdmin()

void com.hyphenate.chat.EMChatRoomManager.asyncAddChatRoomAdmin ( final String chatRoomId,
final String admin,
final EMValueCallBack< EMChatRoom > callBack )

Adds a chat room admin.

Note
Only the chat room owner can call this method.

For the asynchronous method, see addChatRoomAdmin(String, String).

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
adminThe member to be set as the chat room admin.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncBlockChatroomMembers()

void com.hyphenate.chat.EMChatRoomManager.asyncBlockChatroomMembers ( final String chatRoomId,
final List< String > members,
final EMValueCallBack< EMChatRoom > callBack )

Adds members to the block list of the chat room.

Note
Only the chat room owner or admin can call this method.

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
membersThe list of members to be added to block list.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); If this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncChangeChatroomDescription()

void com.hyphenate.chat.EMChatRoomManager.asyncChangeChatroomDescription ( final String chatRoomId,
final String newDescription,
final EMValueCallBack< EMChatRoom > callBack )

Modifies the chat room description.

Note
Only the chat room owner can call this method.

For the synchronous method, see changeChatroomDescription(String, String).

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
newDescriptionThe modified chat room description.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncChangeChatRoomSubject()

void com.hyphenate.chat.EMChatRoomManager.asyncChangeChatRoomSubject ( final String chatRoomId,
final String newSubject,
final EMValueCallBack< EMChatRoom > callBack )

Changes the chat room name.

Note
Only the chat room owner can call this method.

For the synchronous method, see changeChatRoomSubject(String, String).

This is an asynchronous method.

Parameters
chatRoomIdA chat room ID.
newSubjectThe modified chat room name.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncChangeOwner()

void com.hyphenate.chat.EMChatRoomManager.asyncChangeOwner ( final String chatRoomId,
final String newOwner,
final EMValueCallBack< EMChatRoom > callBack ) throws HyphenateException

Transfers the chat room ownership.

Note
Only the chat room owner can call this method.

For the synchronous method, see changeOwner(String, String).

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
newOwnerThe new owner of the chat room.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncCheckIfInMuteList()

void com.hyphenate.chat.EMChatRoomManager.asyncCheckIfInMuteList ( final String chatRoomId,
EMValueCallBack< Boolean > callBack )

Checks whether the current member is muted or not.

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object) to show whether the member is be muted or not; if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncFetchChatRoomAllAttributesFromServer()

void com.hyphenate.chat.EMChatRoomManager.asyncFetchChatRoomAllAttributesFromServer ( String chatRoomId,
@NonNull final EMValueCallBack< Map< String, String > > callBack )

Gets all the custom attributes of a chat room.

This is an asynchronous method.

For the synchronous method, see fetchChatroomAttributes(String,List).

Parameters
chatRoomIdThe chat room ID.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncFetchChatRoomAnnouncement()

void com.hyphenate.chat.EMChatRoomManager.asyncFetchChatRoomAnnouncement ( final String chatRoomId,
final EMValueCallBack< String > callBack )

Gets the chat room announcement from the server.

For the synchronous method, see fetchChatRoomAnnouncement(String).

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object) and returns the chat room announcement; if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncFetchChatroomAttributesFromServer()

void com.hyphenate.chat.EMChatRoomManager.asyncFetchChatroomAttributesFromServer ( String chatRoomId,
List< String > keyList,
@NonNull final EMValueCallBack< Map< String, String > > callBack )

Gets the list of custom chat room attributes based on the attribute key list.

This is an asynchronous method.

For the synchronous method, see fetchChatroomAttributes(String,List).

Parameters
chatRoomIdThe chat room ID.
keyListThe list of chat room attribute keys. If you pass null, the SDK returns all custom attributes of the chat room.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncFetchChatRoomBlackList()

void com.hyphenate.chat.EMChatRoomManager.asyncFetchChatRoomBlackList ( final String chatRoomId,
final int pageNum,
final int pageSize,
final EMValueCallBack< List< String > > callBack )

Gets the chat room block list with pagination.

Note
Only the chat room owner or admin can call this method.

For the synchronous method, see fetchChatRoomBlackList(String, int, int).

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
pageNumThe page number, starting from 1.
pageSizeThe number of members on the block list that you expect to get on each page. The value range is [1,50].
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object) and returns the block list of the chat room; If this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncFetchChatRoomFromServer()

void com.hyphenate.chat.EMChatRoomManager.asyncFetchChatRoomFromServer ( final String roomId,
final EMValueCallBack< EMChatRoom > callback )

Gets details of a chat room from the server.

Note
This method does not get the chat room member list.

This is an asynchronous method.

For the synchronous method, see fetchChatRoomFromServer(String).

Parameters
roomIdThe chat room ID.
callbackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, callsEMValueCallBack#onError(int, String).

◆ asyncFetchChatRoomMembers()

void com.hyphenate.chat.EMChatRoomManager.asyncFetchChatRoomMembers ( final String chatRoomId,
final String cursor,
final int pageSize,
final EMValueCallBack< EMCursorResult< String > > callBack )

Gets the chat room member list.

Note
When EMCursorResult#getCursor() is an empty string ("") amid the result, all data is fetched.

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
cursorThe cursor position from which to start getting data. At the first call, if you set the cursor as "null", the SDK gets chat room members in the reverse chronological order of when members joined the chat room.
pageSizeThe number of members that you expect to get on each page. The value range is [1,50].
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); If this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncFetchChatRoomMuteList()

void com.hyphenate.chat.EMChatRoomManager.asyncFetchChatRoomMuteList ( final String chatRoomId,
final int pageNum,
final int pageSize,
final EMValueCallBack< Map< String, Long > > callBack )

Gets the list of muted chat room members from the server.

Note
Only the chat room owner or admin can call this method.

For the synchronous method, see fetchChatRoomMuteList(String, int, int).

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
pageNumThe page number, starting from 1.
pageSizeThe number of muted members that you expect to get on each page. The value range is [1,50].
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); If this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncFetchPublicChatRoomsFromServer()

void com.hyphenate.chat.EMChatRoomManager.asyncFetchPublicChatRoomsFromServer ( final int pageNum,
final int pageSize,
final EMValueCallBack< EMPageResult< EMChatRoom > > callback )

Gets chat room data from the server with pagination.

This is an asynchronous method.

Parameters
pageNumThe page number, starting from 1.
pageSizeThe number of records that you expect to get on each page. The value range is [1,50].
callbackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object). If this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncMuteChatRoomMembers()

void com.hyphenate.chat.EMChatRoomManager.asyncMuteChatRoomMembers ( final String chatRoomId,
final List< String > muteMembers,
final long duration,
final EMValueCallBack< EMChatRoom > callBack )

Mutes members in a chat room.

Note
Only the chat room owner or admin can call this method.

For the synchronous method, see muteChatRoomMembers(String, List, long).

This is an asynchronous method.

Parameters
chatRoomIdThe chat room 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); if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncRemoveChatRoomAdmin()

void com.hyphenate.chat.EMChatRoomManager.asyncRemoveChatRoomAdmin ( final String chatRoomId,
final String admin,
final EMValueCallBack< EMChatRoom > callBack )

Removes administrative privileges of a chat room admin.

Note
Only the chat room owner can call this method.

For the synchronous method, see removeChatRoomAdmin(String, String).

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
adminThe chat room admin whose administrative privileges are to be removed.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncRemoveChatRoomAttributeFromServer()

void com.hyphenate.chat.EMChatRoomManager.asyncRemoveChatRoomAttributeFromServer ( String chatRoomId,
String key,
@NonNull final EMCallBack callBack )

Removes a custom chat room attribute.

Note
This method does not remove attributes set by other members.

This is an asynchronous method.

For the synchronous method, see removeChatroomAttribute(String,List)

Parameters
chatRoomIdThe chat room ID.
keyThe key of the custom chat room attribute to remove.
callBackThe completion callback. If this call succeeds, calls EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncRemoveChatRoomAttributeFromServerForced()

void com.hyphenate.chat.EMChatRoomManager.asyncRemoveChatRoomAttributeFromServerForced ( String chatRoomId,
String key,
@NonNull final EMCallBack callBack )

Removes a custom chat room attribute forcibly.

Note
This method removes attributes set by other members.

This is an asynchronous method.

For the synchronous method, see removeChatroomAttributeForced(String,List).

Parameters
chatRoomIdThe chat room ID.
keyThe key of the custom chat room attribute to remove.
callBackThe completion callback. If this call succeeds, calls EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncRemoveChatRoomAttributesFromServer()

void com.hyphenate.chat.EMChatRoomManager.asyncRemoveChatRoomAttributesFromServer ( String chatRoomId,
List< String > keyList,
@NonNull final EMResultCallBack< Map< String, Integer > > callBack )

Removes custom chat room attributes by the attribute key list.

Note
This method does not remove attributes set by other members.

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
keyListThe key list of the custom chat room attributes to remove.
callBackThe completion callback. calls EMResultCallBack#onResult(int,Object); return Object is Map={"k1":703}, A description of the exception. See EMError. EXCEED_SERVICE_LIMIT = 4; INVALID_PARAM = 110; QUERY_PARAM_REACHES_LIMIT = 112; CHATROOM_PERMISSION_DENIED = 703;

◆ asyncRemoveChatRoomAttributesFromServerForced()

void com.hyphenate.chat.EMChatRoomManager.asyncRemoveChatRoomAttributesFromServerForced ( String chatRoomId,
List< String > keyList,
@NonNull final EMResultCallBack< Map< String, Integer > > callBack )

Removes custom chat room attributes forcibly.

Note
This method removes attributes set by other members.

This is an asynchronous method.

For the synchronous method, see removeChatroomAttributeForced(String,List).

Parameters
chatRoomIdThe chat room ID.
keyListThe key list of the custom chat room attributes to remove.
callBackThe completion callback. calls EMResultCallBack#onResult(int, Object) (int,Object)}; return Object is Map={"k1":703}, A description of the exception. See EMError. EXCEED_SERVICE_LIMIT = 4; INVALID_PARAM = 110; QUERY_PARAM_REACHES_LIMIT = 112; CHATROOM_PERMISSION_DENIED = 703;

◆ asyncRemoveChatRoomMembers()

void com.hyphenate.chat.EMChatRoomManager.asyncRemoveChatRoomMembers ( final String chatRoomId,
final List< String > members,
final EMValueCallBack< EMChatRoom > callBack )

Removes members from a chat room.

Note
Only the chat room owner or admin can call this method.

For the synchronous method, see removeChatRoomMembers(String, List).

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
membersThe list of members to be removed.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncSetChatroomAttribute()

void com.hyphenate.chat.EMChatRoomManager.asyncSetChatroomAttribute ( String chatRoomId,
String key,
String value,
boolean autoDelete,
@NonNull final EMCallBack callBack )

Sets a custom chat room attribute.

Note
This method does not overwrite attributes set by other members.

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
keyThe chat room attribute key that specifies the attribute name. The attribute name can contain 128 characters at most. A chat room can have a maximum of 100 custom attributes. The following character sets are supported:
  • 26 lowercase English letters (a-z)
  • 26 uppercase English letters (A-Z)
  • 10 numbers (0-9)
  • "_", "-", "."
valueThe chat room attribute value. The attribute value can contain a maximum of 4096 characters. The total length of custom chat room attributes cannot exceed 10 GB for each app.
autoDeleteWhether to delete the chat room attribute set by the member when he or she exits the chat room.
  • (Default)true:Yes.
  • false: No.
callBackThe completion callback. If this call succeeds, calls EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncSetChatroomAttributeForced()

void com.hyphenate.chat.EMChatRoomManager.asyncSetChatroomAttributeForced ( String chatRoomId,
String key,
String value,
boolean autoDelete,
@NonNull final EMCallBack callBack )

Sets a custom chat room attribute forcibly.

Note
This method overwrites attributes set by other members.

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
keyThe chat room attribute key that specifies the attribute name. The attribute name can contain 128 characters at most. A chat room can have a maximum of 100 custom attributes. The following character sets are supported:
  • 26 lowercase English letters (a-z)
  • 26 uppercase English letters (A-Z)
  • 10 numbers (0-9)
  • "_", "-", "."
valueThe chat room attribute value. The attribute value can contain a maximum of 4096 characters. The total length of custom chat room attributes cannot exceed 10 GB for each app.
autoDeleteWhether to delete the chat room attributes set by the member when he or she exits the chat room.
  • (Default)true:Yes.
  • false: No.
callBackThe completion callback. If this call succeeds, calls EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ asyncSetChatroomAttributes()

void com.hyphenate.chat.EMChatRoomManager.asyncSetChatroomAttributes ( String chatRoomId,
Map< String, String > attributeMap,
boolean autoDelete,
@NonNull final EMResultCallBack< Map< String, Integer > > callBack )

Adds custom chat room attributes.

Note
This method does not overwrite attributes set by other members.

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
attributeMapThe new chat room attributes Key-Value. A single key cannot exceed 128 characters; the total number of keys in a chat room cannot exceed 100. A single Value can not exceed 4096 characters. The total attribute can not exceed 10 GB.
autoDeleteWhether to delete the chat room attributes set by the member when he or she exits the chat room.
  • (Default)true:Yes.
  • false: No.
callBackThe completion callback. calls EMResultCallBack#onResult(int, Object); return Object is Map={"k1":703}, A description of the exception. See EMError. EXCEED_SERVICE_LIMIT = 4; INVALID_PARAM = 110; QUERY_PARAM_REACHES_LIMIT = 112; CHATROOM_PERMISSION_DENIED = 703;

◆ asyncSetChatroomAttributesForced()

void com.hyphenate.chat.EMChatRoomManager.asyncSetChatroomAttributesForced ( String chatRoomId,
Map< String, String > attributeMap,
boolean autoDelete,
@NonNull final EMResultCallBack< Map< String, Integer > > callBack )

Sets custom chat room attributes forcibly.

Note
This method overwrites attributes set by other members.

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
attributeMapThe map of new chat room attributes in key-value format. In a key-value pair, the key is the attribute name that can contain 128 characters at most; the value is the attribute value that cannot exceed 4096 characters. A chat room can have a maximum of 100 custom attributes and the total length of custom chat room attributes cannot exceed 10 GB for each app.
autoDeleteWhether to delete the chat room attributes set by the member when he or she exits the chat room.
  • (Default)true:Yes.
  • false: No.
callBackThe completion callback. calls EMResultCallBack#onResult(int,Object); return Object is Map={"k1":703}, A description of the exception. See EMError. EXCEED_SERVICE_LIMIT = 4; INVALID_PARAM = 110; QUERY_PARAM_REACHES_LIMIT = 112; CHATROOM_PERMISSION_DENIED = 703;

◆ asyncUnBlockChatRoomMembers()

void com.hyphenate.chat.EMChatRoomManager.asyncUnBlockChatRoomMembers ( final String chatRoomId,
final List< String > members,
final EMValueCallBack< EMChatRoom > callBack )

Removes members from the block list of the chat room.

Note
Only the chat room owner or admin can call this method.

For the synchronous method, see unblockChatRoomMembers(String, List).

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
membersThe list of members to be removed from the block list.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncUnMuteChatRoomMembers()

void com.hyphenate.chat.EMChatRoomManager.asyncUnMuteChatRoomMembers ( final String chatRoomId,
final List< String > members,
final EMValueCallBack< EMChatRoom > callBack )

Unmutes members in a chat room.

Note
Only the chat room owner or admin can call this method.

For the synchronous method, see unMuteChatRoomMembers(String, List).

This is an asynchronous method.

Parameters
chatRoomIdA chat room ID.
membersThe list of members to be unmuted.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String).

◆ asyncUpdateChatRoomAnnouncement()

void com.hyphenate.chat.EMChatRoomManager.asyncUpdateChatRoomAnnouncement ( final String chatRoomId,
final String announcement,
final EMCallBack callBack )

Updates the chat room announcement.

Note
Only the chat room owner or admin can call this method.

For the synchronous method, see updateChatRoomAnnouncement(String, String).

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID
announcementThe modified announcement content.
callBackThe completion callback. If this call succeeds, calls EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ blockChatroomMembers()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.blockChatroomMembers ( String chatRoomId,
List< String > members ) throws HyphenateException

Adds members to the block list of the chat room.

Note
Only the chat room owner or admin can call this method.

For the asynchronous method, see asyncBlockChatroomMembers(String, List, EMValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
chatRoomIdThe chat room ID.
membersThe list of members to be added to block list.
Returns
The modified chat room instance.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ changeChatroomDescription()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.changeChatroomDescription ( String chatRoomId,
String newDescription ) throws HyphenateException

Modifies the chat room description.

Note
Only the chat room owner can call this method.

For the asynchronous method, see asyncChangeChatroomDescription(String, String, EMValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
chatRoomIdThe chat room ID.
newDescriptionThe modified chat room description.
Returns
The modified chat room instance.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ changeChatRoomSubject()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.changeChatRoomSubject ( String chatRoomId,
String newSubject ) throws HyphenateException

Changes the chat room name.

Note
Only the chat room owner can call this method.

For the asynchronous method, see asyncChangeChatRoomSubject(String, String, EMValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
chatRoomIdThe chat room ID.
newSubjectThe modified chat room name.
Returns
The modified chat room instance.
Exceptions
HyphenateExceptionA description of the exception. See EMError

◆ changeOwner()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.changeOwner ( String chatRoomId,
String newOwner ) throws HyphenateException

Transfers the chat room ownership.

Note
Only the chat room 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
chatRoomIdA chat room ID.
newOwnerThe new owner of the chat room.
Returns
The modified chat room instance.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ checkIfInChatRoomWhiteList()

void com.hyphenate.chat.EMChatRoomManager.checkIfInChatRoomWhiteList ( final String chatRoomId,
EMValueCallBack< Boolean > callBack )

Checks whether the current member is on the chat room block list.

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object) to show whether the member is on the block list; if this call fails, calls EMValueCallBack#onError(int, String).

◆ fetchChatRoomAnnouncement()

String com.hyphenate.chat.EMChatRoomManager.fetchChatRoomAnnouncement ( String chatRoomId) throws HyphenateException

Gets the chat room announcement from the server.

For the asynchronous method, see asyncFetchChatRoomAnnouncement(String, EMValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
chatRoomIdThe chat room ID.
Returns
The chat room announcement.
Exceptions
HyphenateExceptionA description of the exception. See EMError

◆ fetchChatRoomBlackList()

List< String > com.hyphenate.chat.EMChatRoomManager.fetchChatRoomBlackList ( String chatRoomId,
int pageNum,
int pageSize ) throws HyphenateException

Gets the chat room block list with pagination.

Note
Only the chat room owner or admin can call this method.

For the asynchronous method, see asyncFetchChatRoomBlackList(String, int, int, EMValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
chatRoomIdThe chat room ID.
pageNumThe page number, starting from 1.
pageSizeThe number of members on the block list that you expect to get on each page. The value range is [1,50].
Returns
The block list of the chat room.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ fetchChatRoomFromServer()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.fetchChatRoomFromServer ( String roomId) throws HyphenateException

Gets details of a chat room from the server.

Note
This method does not get the member list.

This is a synchronous method and blocks the current thread.

For the asynchronous method, see asyncFetchChatRoomFromServer(String, EMValueCallBack).

Parameters
roomIdThe chat room ID.
Returns
EMChatRoom The chat room instance.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ fetchChatRoomMembers()

EMCursorResult< String > com.hyphenate.chat.EMChatRoomManager.fetchChatRoomMembers ( String chatRoomId,
String cursor,
int pageSize ) throws HyphenateException

Gets the chat room member list.

Note
When EMCursorResult#getCursor() is an empty string ("") amid the result, all data is fetched.

For the asynchronous method, see asyncFetchChatRoomMembers(String, String, int, EMValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
chatRoomIdThe chat room ID.
cursorThe cursor position from which to start getting data. At the first call, if you set the cursor as "null", the SDK gets chat room members in the reverse chronological order of when members joined the chat room.
pageSizeThe number of members that you expect to get on each page. The value range is [1,50].
Returns
The list of chat room members and the cursor for the next query. See EMCursorResult.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ fetchChatRoomMuteList()

Map< String, Long > com.hyphenate.chat.EMChatRoomManager.fetchChatRoomMuteList ( String chatRoomId,
int pageNum,
int pageSize ) throws HyphenateException

Gets the list of muted chat room members from the server.

Note
Only the chat room owner or admin can call this method.

For the asynchronous method, see asyncFetchChatRoomMuteList(String, int, int, EMValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
chatRoomIdThe chat room ID.
pageNumThe page number, starting from 1.
pageSizeThe number of muted members that you expect to get on each page. The value range is [1,50].
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.

◆ fetchChatRoomWhiteList()

void com.hyphenate.chat.EMChatRoomManager.fetchChatRoomWhiteList ( final String chatRoomId,
final EMValueCallBack< List< String > > callBack )

Gets the chat room allow list from the server.

Note
Only the chat room owner or admin can call this method.

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); If this call fails, calls EMValueCallBack#onError(int, String).

◆ fetchPublicChatRoomsFromServer()

EMPageResult< EMChatRoom > com.hyphenate.chat.EMChatRoomManager.fetchPublicChatRoomsFromServer ( int pageNum,
int pageSize ) throws HyphenateException

Gets chat room data from the server with pagination.

This is a synchronous method and blocks the current thread.

The asynchronous method asyncFetchPublicChatRoomsFromServer(int, int, EMValueCallBack) can be used.

Parameters
pageNumThe page number, starting from 1.
pageSizeThe number of records that you expect to get on each page. The value range is [1,50].
Returns
Chat room data. See EMPageResult.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ getChatRoom()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.getChatRoom ( String roomId)

Gets the chat room in the memory.

Parameters
roomIdThe chat room ID.
Returns
The chat room instance. The SDK returns null if the chat room is not found in the memory.

◆ joinChatRoom() [1/2]

void com.hyphenate.chat.EMChatRoomManager.joinChatRoom ( final String roomId,
boolean leaveOtherRooms,
String ext,
final EMValueCallBack< EMChatRoom > callback )

Joins a chat room.

Note
To exit the chat room, call leaveChatRoom(String, EMCallBack) .

This is an asynchronous method.

Parameters
roomIdThe ID of the chat room to join.
leaveOtherRoomsWhether to exit other chat rooms.
extExtended information.
callbackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object) and returns the chat room object; if this call fails, calls EMValueCallBack#onError(int, String), where the first parameter is the error code and the second is the error message.

◆ joinChatRoom() [2/2]

void com.hyphenate.chat.EMChatRoomManager.joinChatRoom ( final String roomId,
final EMValueCallBack< EMChatRoom > callback )

Joins a chat room.

Note
To exit the chat room, call leaveChatRoom(String, EMCallBack) .

This is an asynchronous method.

Parameters
roomIdThe ID of the chat room to join.
callbackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object) and returns the chat room object; if this call fails, calls EMValueCallBack#onError(int, String), where the first parameter is the error code and the second is the error message.

◆ leaveChatRoom() [1/2]

void com.hyphenate.chat.EMChatRoomManager.leaveChatRoom ( final String roomId)

Exits a chat room.

Note
A user that joins a chat room using joinChatRoom(String, EMValueCallBack) can call the leaveChatRoom method to exit the chat room.

This is an asynchronous method.

Parameters
roomIdThe ID of the chat room to exit.

◆ leaveChatRoom() [2/2]

void com.hyphenate.chat.EMChatRoomManager.leaveChatRoom ( final String roomId,
EMCallBack callback )

Exits a chat room.

A user that joins a chat room using joinChatRoom(String, EMValueCallBack) can call the leaveChatRoom method to exit the chat room.

This is an asynchronous method.

Parameters
roomIdThe ID of the chat room to exit.
callbackThe completion callback. If this call succeeds, calls EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String).

◆ muteAllMembers()

void com.hyphenate.chat.EMChatRoomManager.muteAllMembers ( final String chatRoomId,
final EMValueCallBack< EMChatRoom > callBack )

Mutes all members.

Note
Only the chat room owner or admin can call this method.

This method does not work for the chat room owner, admin, and members on the chat room block list.

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String).

◆ muteChatRoomMembers()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.muteChatRoomMembers ( String chatRoomId,
List< String > muteMembers,
long duration ) throws HyphenateException

Mutes members in a chat room.

Note
Only the chat room owner or admin can call this method.

For the asynchronous method, see asyncMuteChatRoomMembers(String, List, long, EMValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
chatRoomIdThe chat room 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 modified chat room instance.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ removeChatRoomAdmin()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.removeChatRoomAdmin ( String chatRoomId,
String admin ) throws HyphenateException

Removes administrative privileges of a chat room admin.

Note
Only the chat room owner can call this method.

For the asynchronous method, see asyncRemoveChatRoomAdmin(String, String, EMValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
chatRoomIdThe chat room ID.
adminThe chat room admin whose administrative privileges are to be removed.
Returns
The modified chat room instance.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ removeChatRoomChangeListener()

void com.hyphenate.chat.EMChatRoomManager.removeChatRoomChangeListener ( EMChatRoomChangeListener listener)

Removes the chat room event listener.

Note
This method removes the chat room event listener added with addChatRoomChangeListener(EMChatRoomChangeListener).
Parameters
listenerThe chat room event listener to be removed.

◆ removeChatRoomMembers()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.removeChatRoomMembers ( String chatRoomId,
List< String > members ) throws HyphenateException

Removes members from a chat room.

Note
Only the chat room owner or admin can call this method.

For the asynchronous method, see asyncRemoveChatRoomMembers(String, List, EMValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
chatRoomIdThe chat room ID.
membersThe list of members to be removed.
Returns
The modified chat room instance.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ removeFromChatRoomWhiteList()

void com.hyphenate.chat.EMChatRoomManager.removeFromChatRoomWhiteList ( final String chatRoomId,
final List< String > members,
final EMValueCallBack< EMChatRoom > callBack )

Removes members from the chat room block list.

Note
Only the chat room owner or admin can call this method.

For members removed from the block list, muteAllMembers(String, EMValueCallBack) works.

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
membersThe list of members to be removed from the chat room block list.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String).

◆ unblockChatRoomMembers()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.unblockChatRoomMembers ( String chatRoomId,
List< String > members ) throws HyphenateException

Removes members from the block list of the chat room.

Note
Only the chat room owner or admin can call this method.

For the asynchronous method, see asyncBlockChatroomMembers(String, List, EMValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
chatRoomIdThe chat room ID.
membersThe list of members to be removed from the block list.
Returns
The modified chat room instance.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ unmuteAllMembers()

void com.hyphenate.chat.EMChatRoomManager.unmuteAllMembers ( final String chatRoomId,
final EMValueCallBack< EMChatRoom > callBack )

Unmutes all members.

Note
Only the chat room owner or admin can call this method.

This is an asynchronous method.

Parameters
chatRoomIdThe chat room ID.
callBackThe completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); If this call fails, calls EMValueCallBack#onError(int, String).

◆ unMuteChatRoomMembers()

EMChatRoom com.hyphenate.chat.EMChatRoomManager.unMuteChatRoomMembers ( String chatRoomId,
List< String > members ) throws HyphenateException

Unmutes members in a chat room.

Note
Only the chat room owner or admin can call this method.

For the asynchronous method, see asyncUnMuteChatRoomMembers(String, List, EMValueCallBack).

This is a synchronous method and blocks the current thread.

Parameters
chatRoomIdThe chat room ID.
membersThe list of members to be unmuted.
Returns
The modified chat room instance.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

◆ updateChatRoomAnnouncement()

void com.hyphenate.chat.EMChatRoomManager.updateChatRoomAnnouncement ( String chatRoomId,
String announcement ) throws HyphenateException

Updates the chat room announcement.

Note
Only the chat room owner or admin can call this method.

For the asynchronous method, see asyncUpdateChatRoomAnnouncement(String, String, EMCallBack).

This is a synchronous method and blocks the current thread.

Parameters
chatRoomIdThe chat room ID.
announcementThe modified announcement content.
Exceptions
HyphenateExceptionA description of the exception. See EMError.

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