hyphenate_SDK4.0 4.8.0
hyphenate java IM SDK
|
Public Member Functions | |
void | addChatRoomChangeListener (EMChatRoomChangeListener listener) |
void | removeChatRoomChangeListener (EMChatRoomChangeListener listener) |
void | removeChatRoomListener (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< EMChatRoom > | fetchPublicChatRoomsFromServer (int pageNum, int pageSize) throws HyphenateException |
EMCursorResult< EMChatRoom > | fetchPublicChatRoomsFromServer (int pageSize, String cursor) throws HyphenateException |
void | asyncFetchPublicChatRoomsFromServer (final int pageSize, final String cursor, final EMValueCallBack< EMCursorResult< EMChatRoom > > callback) |
void | asyncFetchPublicChatRoomsFromServer (final int pageNum, final int pageSize, final EMValueCallBack< EMPageResult< EMChatRoom > > callback) |
EMChatRoom | fetchChatRoomFromServer (String roomId) throws HyphenateException |
EMChatRoom | fetchChatRoomFromServer (String roomId, boolean fetchMembers) throws HyphenateException |
void | asyncFetchChatRoomFromServer (final String roomId, final EMValueCallBack< EMChatRoom > callback) |
EMChatRoom | getChatRoom (String roomId) |
List< EMChatRoom > | getAllChatRooms () |
EMChatRoom | createChatRoom (String subject, String description, String welcomeMessage, int maxUserCount, List< String > members) throws HyphenateException |
void | asyncCreateChatRoom (final String subject, final String description, final String welcomeMessage, final int maxUserCount, final List< String > members, final EMValueCallBack< EMChatRoom > callBack) |
void | destroyChatRoom (String chatRoomId) throws HyphenateException |
void | asyncDestroyChatRoom (final String chatRoomId, final EMCallBack callBack) |
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) |
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:
EMChatRoom com.hyphenate.chat.EMChatRoomManager.addChatRoomAdmin | ( | String | chatRoomId, |
String | admin | ||
) | throws HyphenateException |
Adds a chat room admin.
For the asynchronous method, see asyncAddChatRoomAdmin(String, String, EMValueCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
admin | The member to be set as the chat room admin. |
HyphenateException | A description of the exception. See EMError. |
void com.hyphenate.chat.EMChatRoomManager.addChatRoomChangeListener | ( | EMChatRoomChangeListener | listener | ) |
Adds a chat room event listener.
Chat room event listeners added with this method can be removed by calling removeChatRoomListener(EMChatRoomChangeListener).
listener | A chat room event listener. See EMChatRoomChangeListener. |
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.
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.
chatRoomId | The chat room ID. |
members | The list of members to be added to the allowlist. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String). |
void com.hyphenate.chat.EMChatRoomManager.asyncAddChatRoomAdmin | ( | final String | chatRoomId, |
final String | admin, | ||
final EMValueCallBack< EMChatRoom > | callBack | ||
) |
Adds a chat room admin.
For the asynchronous method, see addChatRoomAdmin(String, String).
This is an asynchronous method.
chatRoomId | The chat room ID. |
admin | The member to be set as the chat room admin. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String). |
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.
This is an asynchronous method.
chatRoomId | The chat room ID. |
members | The list of members to be added to block list. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); If this call fails, calls EMValueCallBack#onError(int, String). |
void com.hyphenate.chat.EMChatRoomManager.asyncChangeChatroomDescription | ( | final String | chatRoomId, |
final String | newDescription, | ||
final EMValueCallBack< EMChatRoom > | callBack | ||
) |
Modifies the chat room description.
For the synchronous method, see changeChatroomDescription(String, String).
This is an asynchronous method.
chatRoomId | The chat room ID. |
newDescription | The modified chat room description. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String). |
void com.hyphenate.chat.EMChatRoomManager.asyncChangeChatRoomSubject | ( | final String | chatRoomId, |
final String | newSubject, | ||
final EMValueCallBack< EMChatRoom > | callBack | ||
) |
Changes the chat room name.
For the synchronous method, see changeChatRoomSubject(String, String).
This is an asynchronous method.
chatRoomId | A chat room ID. |
newSubject | The modified chat room name. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String). |
void com.hyphenate.chat.EMChatRoomManager.asyncChangeOwner | ( | final String | chatRoomId, |
final String | newOwner, | ||
final EMValueCallBack< EMChatRoom > | callBack | ||
) | throws HyphenateException |
Transfers the chat room ownership.
For the synchronous method, see changeOwner(String, String).
This is an asynchronous method.
chatRoomId | The chat room ID. |
newOwner | The new owner of the chat room. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String). |
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.
chatRoomId | The chat room ID. |
callBack | The 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). |
void com.hyphenate.chat.EMChatRoomManager.asyncCreateChatRoom | ( | final String | subject, |
final String | description, | ||
final String | welcomeMessage, | ||
final int | maxUserCount, | ||
final List< String > | members, | ||
final EMValueCallBack< EMChatRoom > | callBack | ||
) |
Creates a chat room.
For the synchronous method, see createChatRoom(String, String, String, int, List).
This is an asynchronous method.
subject | The chat room name. |
description | The chat room description. |
welcomeMessage | A welcome message for inviting users to join the chat room. |
maxUserCount | The maximum number of members allowed in the chat room. |
members | The list of users invited to join the chat room. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String). |
void com.hyphenate.chat.EMChatRoomManager.asyncDestroyChatRoom | ( | final String | chatRoomId, |
final EMCallBack | callBack | ||
) |
Destroys a chat room.
For the synchronous method, see destroyChatRoom(String).
This is an asynchronous method.
chatRoomId | The chat room ID. |
callBack | The completion callback. If this call succeeds, calls EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String). |
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).
chatRoomId | The chat room ID. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String). |
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.
chatRoomId | The chat room ID. |
callBack | The 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). |
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).
chatRoomId | The chat room ID. |
keyList | The list of chat room attribute keys. If you pass null , the SDK returns all custom attributes of the chat room. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String). |
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.
For the synchronous method, see fetchChatRoomBlackList(String, int, int).
This is an asynchronous method.
chatRoomId | The chat room ID. |
pageNum | The page number, starting from 1. |
pageSize | The number of members on the block list that you expect to get on each page. The value range is [1,50]. |
callBack | The 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). |
void com.hyphenate.chat.EMChatRoomManager.asyncFetchChatRoomFromServer | ( | final String | roomId, |
final EMValueCallBack< EMChatRoom > | callback | ||
) |
Gets details of a chat room from the server.
This is an asynchronous method.
For the synchronous method, see fetchChatRoomFromServer(String).
roomId | The chat room ID. |
callback | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, callsEMValueCallBack#onError(int, String). |
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.
This is an asynchronous method.
chatRoomId | The chat room ID. |
cursor | The 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. |
pageSize | The number of members that you expect to get on each page. The value range is [1,50]. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); If this call fails, calls EMValueCallBack#onError(int, String). |
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.
For the synchronous method, see fetchChatRoomMuteList(String, int, int).
This is an asynchronous method.
chatRoomId | The chat room ID. |
pageNum | The page number, starting from 1. |
pageSize | The number of muted members that you expect to get on each page. The value range is [1,50]. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); If this call fails, calls EMValueCallBack#onError(int, String). |
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.
pageNum | The page number, starting from 1. |
pageSize | The number of records that you expect to get on each page. The value range is [1,50]. |
callback | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object). If this call fails, calls EMValueCallBack#onError(int, String). |
void com.hyphenate.chat.EMChatRoomManager.asyncFetchPublicChatRoomsFromServer | ( | final int | pageSize, |
final String | cursor, | ||
final EMValueCallBack< EMCursorResult< EMChatRoom > > | callback | ||
) |
Gets chat room data from the server with pagination.
This is an asynchronous method.
pageSize | The number of records that you expect to get on each page. The value range is [1,50]. |
cursor | The cursor position from which to start getting data. |
callback | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); If this call fails, calls EMValueCallBack#onError(int, String). |
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.
For the synchronous method, see muteChatRoomMembers(String, List, long).
This is an asynchronous method.
chatRoomId | The chat room ID. |
muteMembers | The list of members to be muted. |
duration | The mute duration in milliseconds. The value -1 indicates that the members are muted permanently. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String). |
void com.hyphenate.chat.EMChatRoomManager.asyncRemoveChatRoomAdmin | ( | final String | chatRoomId, |
final String | admin, | ||
final EMValueCallBack< EMChatRoom > | callBack | ||
) |
Removes administrative privileges of a chat room admin.
For the synchronous method, see removeChatRoomAdmin(String, String).
This is an asynchronous method.
chatRoomId | The chat room ID. |
admin | The chat room admin whose administrative privileges are to be removed. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String). |
void com.hyphenate.chat.EMChatRoomManager.asyncRemoveChatRoomAttributeFromServer | ( | String | chatRoomId, |
String | key, | ||
@NonNull final EMCallBack | callBack | ||
) |
Removes a custom chat room attribute.
This is an asynchronous method.
For the synchronous method, see removeChatroomAttribute(String,List)
chatRoomId | The chat room ID. |
key | The key of the custom chat room attribute to remove. |
callBack | The completion callback. If this call succeeds, calls EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String). |
void com.hyphenate.chat.EMChatRoomManager.asyncRemoveChatRoomAttributeFromServerForced | ( | String | chatRoomId, |
String | key, | ||
@NonNull final EMCallBack | callBack | ||
) |
Removes a custom chat room attribute forcibly.
This is an asynchronous method.
For the synchronous method, see removeChatroomAttributeForced(String,List).
chatRoomId | The chat room ID. |
key | The key of the custom chat room attribute to remove. |
callBack | The completion callback. If this call succeeds, calls EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String). |
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.
This is an asynchronous method.
chatRoomId | The chat room ID. |
keyList | The key list of the custom chat room attributes to remove. |
callBack | The 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; |
void com.hyphenate.chat.EMChatRoomManager.asyncRemoveChatRoomAttributesFromServerForced | ( | String | chatRoomId, |
List< String > | keyList, | ||
@NonNull final EMResultCallBack< Map< String, Integer > > | callBack | ||
) |
Removes custom chat room attributes forcibly.
This is an asynchronous method.
For the synchronous method, see removeChatroomAttributeForced(String,List).
chatRoomId | The chat room ID. |
keyList | The key list of the custom chat room attributes to remove. |
callBack | The 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; |
void com.hyphenate.chat.EMChatRoomManager.asyncRemoveChatRoomMembers | ( | final String | chatRoomId, |
final List< String > | members, | ||
final EMValueCallBack< EMChatRoom > | callBack | ||
) |
Removes members from a chat room.
For the synchronous method, see removeChatRoomMembers(String, List).
This is an asynchronous method.
chatRoomId | The chat room ID. |
members | The list of members to be removed. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String). |
void com.hyphenate.chat.EMChatRoomManager.asyncSetChatroomAttribute | ( | String | chatRoomId, |
String | key, | ||
String | value, | ||
boolean | autoDelete, | ||
@NonNull final EMCallBack | callBack | ||
) |
Sets a custom chat room attribute.
This is an asynchronous method.
chatRoomId | The chat room ID. |
key | The 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:
|
value | The 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. |
autoDelete | Whether to delete the chat room attribute set by the member when he or she exits the chat room.
|
callBack | The completion callback. If this call succeeds, calls EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String). |
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.
This is an asynchronous method.
chatRoomId | The chat room ID. |
key | The 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:
|
value | The 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. |
autoDelete | Whether to delete the chat room attributes set by the member when he or she exits the chat room.
|
callBack | The completion callback. If this call succeeds, calls EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String). |
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.
This is an asynchronous method.
chatRoomId | The chat room ID. |
attributeMap | The 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. |
autoDelete | Whether to delete the chat room attributes set by the member when he or she exits the chat room.
|
callBack | The 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; |
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.
This is an asynchronous method.
chatRoomId | The chat room ID. |
attributeMap | The 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. |
autoDelete | Whether to delete the chat room attributes set by the member when he or she exits the chat room.
|
callBack | The 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; |
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.
For the synchronous method, see unblockChatRoomMembers(String, List).
This is an asynchronous method.
chatRoomId | The chat room ID. |
members | The list of members to be removed from the block list. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String). |
void com.hyphenate.chat.EMChatRoomManager.asyncUnMuteChatRoomMembers | ( | final String | chatRoomId, |
final List< String > | members, | ||
final EMValueCallBack< EMChatRoom > | callBack | ||
) |
Unmutes members in a chat room.
For the synchronous method, see unMuteChatRoomMembers(String, List).
This is an asynchronous method.
chatRoomId | A chat room ID. |
members | The list of members to be unmuted. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String). |
void com.hyphenate.chat.EMChatRoomManager.asyncUpdateChatRoomAnnouncement | ( | final String | chatRoomId, |
final String | announcement, | ||
final EMCallBack | callBack | ||
) |
Updates the chat room announcement.
For the synchronous method, see updateChatRoomAnnouncement(String, String).
This is an asynchronous method.
chatRoomId | The chat room ID |
announcement | The modified announcement content. |
callBack | The completion callback. If this call succeeds, calls EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String). |
EMChatRoom com.hyphenate.chat.EMChatRoomManager.blockChatroomMembers | ( | String | chatRoomId, |
List< String > | members | ||
) | throws HyphenateException |
Adds members to the block list of the chat room.
For the asynchronous method, see asyncBlockChatroomMembers(String, List, EMValueCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
members | The list of members to be added to block list. |
HyphenateException | A description of the exception. See EMError. |
EMChatRoom com.hyphenate.chat.EMChatRoomManager.changeChatroomDescription | ( | String | chatRoomId, |
String | newDescription | ||
) | throws HyphenateException |
Modifies the chat room description.
For the asynchronous method, see asyncChangeChatroomDescription(String, String, EMValueCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
newDescription | The modified chat room description. |
HyphenateException | A description of the exception. See EMError. |
EMChatRoom com.hyphenate.chat.EMChatRoomManager.changeChatRoomSubject | ( | String | chatRoomId, |
String | newSubject | ||
) | throws HyphenateException |
Changes the chat room name.
For the asynchronous method, see asyncChangeChatRoomSubject(String, String, EMValueCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
newSubject | The modified chat room name. |
HyphenateException | A description of the exception. See EMError |
EMChatRoom com.hyphenate.chat.EMChatRoomManager.changeOwner | ( | String | chatRoomId, |
String | newOwner | ||
) | throws HyphenateException |
Transfers the chat room ownership.
For the asynchronous method, see asyncChangeOwner(String, String, EMValueCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | A chat room ID. |
newOwner | The new owner of the chat room. |
HyphenateException | A description of the exception. See EMError. |
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.
chatRoomId | The chat room ID. |
callBack | The 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). |
EMChatRoom com.hyphenate.chat.EMChatRoomManager.createChatRoom | ( | String | subject, |
String | description, | ||
String | welcomeMessage, | ||
int | maxUserCount, | ||
List< String > | members | ||
) | throws HyphenateException |
Creates a chat room.
@Note For the asynchronous method, see asyncCreateChatRoom(String, String, String, int, List, EMValueCallBack).
This is a synchronous method and blocks the current thread.
subject | The chat room name. |
description | The chat room description. |
welcomeMessage | A welcome message inviting users to join the chat room. |
maxUserCount | The maximum number of members allowed in the chat room. |
members | The list of users invited to join the chat room. |
HyphenateException | A description of the exception. See EMError. |
void com.hyphenate.chat.EMChatRoomManager.destroyChatRoom | ( | String | chatRoomId | ) | throws HyphenateException |
Destroys a chat room.
For the asynchronous method, see asyncDestroyChatRoom(String, EMCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
HyphenateException | A description of the exception. See EMError. |
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.
chatRoomId | The chat room ID. |
HyphenateException | A description of the exception. See EMError |
List< String > com.hyphenate.chat.EMChatRoomManager.fetchChatRoomBlackList | ( | String | chatRoomId, |
int | pageNum, | ||
int | pageSize | ||
) | throws HyphenateException |
Gets the chat room block list with pagination.
For the asynchronous method, see asyncFetchChatRoomBlackList(String, int, int, EMValueCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
pageNum | The page number, starting from 1. |
pageSize | The number of members on the block list that you expect to get on each page. The value range is [1,50]. |
HyphenateException | A description of the exception. See EMError. |
EMChatRoom com.hyphenate.chat.EMChatRoomManager.fetchChatRoomFromServer | ( | String | roomId | ) | throws HyphenateException |
Gets details of a chat room from the server.
This is a synchronous method and blocks the current thread.
For the asynchronous method, see asyncFetchChatRoomFromServer(String, EMValueCallBack).
roomId | The chat room ID. |
HyphenateException | A description of the exception. See EMError. |
EMChatRoom com.hyphenate.chat.EMChatRoomManager.fetchChatRoomFromServer | ( | String | roomId, |
boolean | fetchMembers | ||
) | throws HyphenateException |
Gets details of a chat room from the server.
This is a synchronous method and blocks the current thread.
roomId | The chat room ID. |
fetchMembers | Whether to get chat room members. |
HyphenateException | A description of the exception. See EMError. |
EMCursorResult< String > com.hyphenate.chat.EMChatRoomManager.fetchChatRoomMembers | ( | String | chatRoomId, |
String | cursor, | ||
int | pageSize | ||
) | throws HyphenateException |
Gets the chat room member list.
For the asynchronous method, see asyncFetchChatRoomMembers(String, String, int, EMValueCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
cursor | The 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. |
pageSize | The number of members that you expect to get on each page. The value range is [1,50]. |
HyphenateException | A description of the exception. See EMError. |
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.
For the asynchronous method, see asyncFetchChatRoomMuteList(String, int, int, EMValueCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
pageNum | The page number, starting from 1. |
pageSize | The number of muted members that you expect to get on each page. The value range is [1,50]. |
HyphenateException | A description of the exception. See EMError. |
void com.hyphenate.chat.EMChatRoomManager.fetchChatRoomWhiteList | ( | final String | chatRoomId, |
final EMValueCallBack< List< String > > | callBack | ||
) |
Gets the chat room allow list from the server.
This is an asynchronous method.
chatRoomId | The chat room ID. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); If this call fails, calls EMValueCallBack#onError(int, String). |
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.
pageNum | The page number, starting from 1. |
pageSize | The number of records that you expect to get on each page. The value range is [1,50]. |
HyphenateException | A description of the exception. See EMError. |
EMCursorResult< EMChatRoom > com.hyphenate.chat.EMChatRoomManager.fetchPublicChatRoomsFromServer | ( | int | pageSize, |
String | cursor | ||
) | throws HyphenateException |
Gets chat room data from the server with pagination.
As this method is time-consuming, the asynchronous method asyncFetchPublicChatRoomsFromServer(int, String, EMValueCallBack) can be used.
This is a synchronous method and blocks the current thread.
pageSize | The number of records per page. The value range is [1,50]. |
cursor | The cursor position from which to start getting data. |
HyphenateException | A description of the exception. See EMError. |
List< EMChatRoom > com.hyphenate.chat.EMChatRoomManager.getAllChatRooms | ( | ) |
Gets the list of chat rooms in the memory.
EMChatRoom com.hyphenate.chat.EMChatRoomManager.getChatRoom | ( | String | roomId | ) |
Gets the chat room in the memory.
roomId | The chat room ID. |
void com.hyphenate.chat.EMChatRoomManager.joinChatRoom | ( | final String | roomId, |
boolean | leaveOtherRooms, | ||
String | ext, | ||
final EMValueCallBack< EMChatRoom > | callback | ||
) |
Joins a chat room.
This is an asynchronous method.
roomId | The ID of the chat room to join. |
leaveOtherRooms | Whether to exit other chat rooms. |
ext | Extended information. |
callback | The 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. |
void com.hyphenate.chat.EMChatRoomManager.joinChatRoom | ( | final String | roomId, |
final EMValueCallBack< EMChatRoom > | callback | ||
) |
Joins a chat room.
This is an asynchronous method.
roomId | The ID of the chat room to join. |
callback | The 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. |
void com.hyphenate.chat.EMChatRoomManager.leaveChatRoom | ( | final String | roomId | ) |
Exits a chat room.
This is an asynchronous method.
roomId | The ID of the chat room to exit. |
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.
roomId | The ID of the chat room to exit. |
callback | The completion callback. If this call succeeds, calls EMCallBack#onSuccess(); if this call fails, calls EMCallBack#onError(int, String). |
void com.hyphenate.chat.EMChatRoomManager.muteAllMembers | ( | final String | chatRoomId, |
final EMValueCallBack< EMChatRoom > | callBack | ||
) |
Mutes all members.
This method does not work for the chat room owner, admin, and members on the chat room block list.
This is an asynchronous method.
chatRoomId | The chat room ID. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String). |
EMChatRoom com.hyphenate.chat.EMChatRoomManager.muteChatRoomMembers | ( | String | chatRoomId, |
List< String > | muteMembers, | ||
long | duration | ||
) | throws HyphenateException |
Mutes members in a chat room.
For the asynchronous method, see asyncMuteChatRoomMembers(String, List, long, EMValueCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
muteMembers | The list of members to be muted. |
duration | The mute duration in milliseconds. The value -1 indicates that the members are muted permanently. |
HyphenateException | A description of the exception. See EMError. |
EMChatRoom com.hyphenate.chat.EMChatRoomManager.removeChatRoomAdmin | ( | String | chatRoomId, |
String | admin | ||
) | throws HyphenateException |
Removes administrative privileges of a chat room admin.
For the asynchronous method, see asyncRemoveChatRoomAdmin(String, String, EMValueCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
admin | The chat room admin whose administrative privileges are to be removed. |
HyphenateException | A description of the exception. See EMError. |
void com.hyphenate.chat.EMChatRoomManager.removeChatRoomChangeListener | ( | EMChatRoomChangeListener | listener | ) |
Removes a chat room event listener.
Currently, removeChatRoomListener(EMChatRoomChangeListener) is recommended to remove a chat room event listener.
listener | The chat room listener to be removed. |
void com.hyphenate.chat.EMChatRoomManager.removeChatRoomListener | ( | EMChatRoomChangeListener | listener | ) |
Removes the chat room event listener.
listener | The chat room event listener to be removed. |
EMChatRoom com.hyphenate.chat.EMChatRoomManager.removeChatRoomMembers | ( | String | chatRoomId, |
List< String > | members | ||
) | throws HyphenateException |
Removes members from a chat room.
For the asynchronous method, see asyncRemoveChatRoomMembers(String, List, EMValueCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
members | The list of members to be removed. |
HyphenateException | A description of the exception. See EMError. |
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.
For members removed from the block list, muteAllMembers(String, EMValueCallBack) works.
This is an asynchronous method.
chatRoomId | The chat room ID. |
members | The list of members to be removed from the chat room block list. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); if this call fails, calls EMValueCallBack#onError(int, String). |
EMChatRoom com.hyphenate.chat.EMChatRoomManager.unblockChatRoomMembers | ( | String | chatRoomId, |
List< String > | members | ||
) | throws HyphenateException |
Removes members from the block list of the chat room.
For the asynchronous method, see asyncBlockChatroomMembers(String, List, EMValueCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
members | The list of members to be removed from the block list. |
HyphenateException | A description of the exception. See EMError. |
void com.hyphenate.chat.EMChatRoomManager.unmuteAllMembers | ( | final String | chatRoomId, |
final EMValueCallBack< EMChatRoom > | callBack | ||
) |
Unmutes all members.
This is an asynchronous method.
chatRoomId | The chat room ID. |
callBack | The completion callback. If this call succeeds, calls EMValueCallBack#onSuccess(Object); If this call fails, calls EMValueCallBack#onError(int, String). |
EMChatRoom com.hyphenate.chat.EMChatRoomManager.unMuteChatRoomMembers | ( | String | chatRoomId, |
List< String > | members | ||
) | throws HyphenateException |
Unmutes members in a chat room.
For the asynchronous method, see asyncUnMuteChatRoomMembers(String, List, EMValueCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
members | The list of members to be unmuted. |
HyphenateException | A description of the exception. See EMError. |
void com.hyphenate.chat.EMChatRoomManager.updateChatRoomAnnouncement | ( | String | chatRoomId, |
String | announcement | ||
) | throws HyphenateException |
Updates the chat room announcement.
For the asynchronous method, see asyncUpdateChatRoomAnnouncement(String, String, EMCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
announcement | The modified announcement content. |
HyphenateException | A description of the exception. See EMError. |