Chat SDK for Android v1.2.1
agora java chat SDK
|
Public Member Functions | |
void | addChatRoomChangeListener (ChatRoomChangeListener listener) |
void | removeChatRoomChangeListener (ChatRoomChangeListener listener) |
void | removeChatRoomListener (ChatRoomChangeListener listener) |
void | joinChatRoom (final String roomId, final ValueCallBack< ChatRoom > callback) |
void | leaveChatRoom (final String roomId) |
void | leaveChatRoom (final String roomId, CallBack callback) |
PageResult< ChatRoom > | fetchPublicChatRoomsFromServer (int pageNum, int pageSize) throws ChatException |
CursorResult< ChatRoom > | fetchPublicChatRoomsFromServer (int pageSize, String cursor) throws ChatException |
void | asyncFetchPublicChatRoomsFromServer (final int pageSize, final String cursor, final ValueCallBack< CursorResult< ChatRoom > > callback) |
void | asyncFetchPublicChatRoomsFromServer (final int pageNum, final int pageSize, final ValueCallBack< PageResult< ChatRoom > > callback) |
ChatRoom | fetchChatRoomFromServer (String roomId) throws ChatException |
ChatRoom | fetchChatRoomFromServer (String roomId, boolean fetchMembers) throws ChatException |
void | asyncFetchChatRoomFromServer (final String roomId, final ValueCallBack< ChatRoom > callback) |
ChatRoom | getChatRoom (String roomId) |
List< ChatRoom > | getAllChatRooms () |
ChatRoom | createChatRoom (String subject, String description, String welcomeMessage, int maxUserCount, List< String > members) throws ChatException |
void | asyncCreateChatRoom (final String subject, final String description, final String welcomeMessage, final int maxUserCount, final List< String > members, final ValueCallBack< ChatRoom > callBack) |
void | destroyChatRoom (String chatRoomId) throws ChatException |
void | asyncDestroyChatRoom (final String chatRoomId, final CallBack callBack) |
ChatRoom | changeChatRoomSubject (String chatRoomId, String newSubject) throws ChatException |
void | asyncChangeChatRoomSubject (final String chatRoomId, final String newSubject, final ValueCallBack< ChatRoom > callBack) |
ChatRoom | changeChatroomDescription (String chatRoomId, String newDescription) throws ChatException |
void | asyncChangeChatroomDescription (final String chatRoomId, final String newDescription, final ValueCallBack< ChatRoom > callBack) |
CursorResult< String > | fetchChatRoomMembers (String chatRoomId, String cursor, int pageSize) throws ChatException |
void | asyncFetchChatRoomMembers (final String chatRoomId, final String cursor, final int pageSize, final ValueCallBack< CursorResult< String > > callBack) |
ChatRoom | muteChatRoomMembers (String chatRoomId, List< String > muteMembers, long duration) throws ChatException |
void | asyncMuteChatRoomMembers (final String chatRoomId, final List< String > muteMembers, final long duration, final ValueCallBack< ChatRoom > callBack) |
ChatRoom | unMuteChatRoomMembers (String chatRoomId, List< String > members) throws ChatException |
void | asyncUnMuteChatRoomMembers (final String chatRoomId, final List< String > members, final ValueCallBack< ChatRoom > callBack) |
ChatRoom | changeOwner (String chatRoomId, String newOwner) throws ChatException |
void | asyncChangeOwner (final String chatRoomId, final String newOwner, final ValueCallBack< ChatRoom > callBack) throws ChatException |
ChatRoom | addChatRoomAdmin (String chatRoomId, String admin) throws ChatException |
void | asyncAddChatRoomAdmin (final String chatRoomId, final String admin, final ValueCallBack< ChatRoom > callBack) |
ChatRoom | removeChatRoomAdmin (String chatRoomId, String admin) throws ChatException |
void | asyncRemoveChatRoomAdmin (final String chatRoomId, final String admin, final ValueCallBack< ChatRoom > callBack) |
Map< String, Long > | fetchChatRoomMuteList (String chatRoomId, int pageNum, int pageSize) throws ChatException |
void | asyncFetchChatRoomMuteList (final String chatRoomId, final int pageNum, final int pageSize, final ValueCallBack< Map< String, Long > > callBack) |
ChatRoom | removeChatRoomMembers (String chatRoomId, List< String > members) throws ChatException |
void | asyncRemoveChatRoomMembers (final String chatRoomId, final List< String > members, final ValueCallBack< ChatRoom > callBack) |
ChatRoom | blockChatroomMembers (String chatRoomId, List< String > members) throws ChatException |
void | asyncBlockChatroomMembers (final String chatRoomId, final List< String > members, final ValueCallBack< ChatRoom > callBack) |
ChatRoom | unblockChatRoomMembers (String chatRoomId, List< String > members) throws ChatException |
void | asyncUnBlockChatRoomMembers (final String chatRoomId, final List< String > members, final ValueCallBack< ChatRoom > callBack) |
List< String > | fetchChatRoomBlackList (String chatRoomId, int pageNum, int pageSize) throws ChatException |
void | asyncFetchChatRoomBlackList (final String chatRoomId, final int pageNum, final int pageSize, final ValueCallBack< List< String > > callBack) |
void | addToChatRoomWhiteList (final String chatRoomId, final List< String > members, final ValueCallBack< ChatRoom > callBack) |
void | removeFromChatRoomWhiteList (final String chatRoomId, final List< String > members, final ValueCallBack< ChatRoom > callBack) |
void | checkIfInChatRoomWhiteList (final String chatRoomId, ValueCallBack< Boolean > callBack) |
void | asyncCheckIfInMuteList (final String chatRoomId, ValueCallBack< Boolean > callBack) |
void | fetchChatRoomWhiteList (final String chatRoomId, final ValueCallBack< List< String > > callBack) |
void | muteAllMembers (final String chatRoomId, final ValueCallBack< ChatRoom > callBack) |
void | unmuteAllMembers (final String chatRoomId, final ValueCallBack< ChatRoom > callBack) |
void | updateChatRoomAnnouncement (String chatRoomId, String announcement) throws ChatException |
void | asyncUpdateChatRoomAnnouncement (final String chatRoomId, final String announcement, final CallBack callBack) |
String | fetchChatRoomAnnouncement (String chatRoomId) throws ChatException |
void | asyncFetchChatRoomAnnouncement (final String chatRoomId, final ValueCallBack< String > callBack) |
void | asyncSetChatroomAttributes (String chatRoomId, Map< String, String > attributeMap, boolean autoDelete, @NonNull final ResultCallBack< Map< String, Integer > > callBack) |
void | asyncSetChatroomAttribute (String chatRoomId, String key, String value, boolean autoDelete, @NonNull final CallBack callBack) |
void | asyncSetChatroomAttributesForced (String chatRoomId, Map< String, String > attributeMap, boolean autoDelete, @NonNull final ResultCallBack< Map< String, Integer > > callBack) |
void | asyncSetChatroomAttributeForced (String chatRoomId, String key, String value, boolean autoDelete, @NonNull final CallBack callBack) |
void | asyncFetchChatroomAttributesFromServer (String chatRoomId, List< String > keyList, @NonNull final ValueCallBack< Map< String, String > > callBack) |
void | asyncFetchChatRoomAllAttributesFromServer (String chatRoomId, @NonNull final ValueCallBack< Map< String, String > > callBack) |
void | asyncRemoveChatRoomAttributesFromServer (String chatRoomId, List< String > keyList, @NonNull final ResultCallBack< Map< String, Integer > > callBack) |
void | asyncRemoveChatRoomAttributeFromServer (String chatRoomId, String key, @NonNull final CallBack callBack) |
void | asyncRemoveChatRoomAttributesFromServerForced (String chatRoomId, List< String > keyList, @NonNull final ResultCallBack< Map< String, Integer > > callBack) |
void | asyncRemoveChatRoomAttributeFromServerForced (String chatRoomId, String key, @NonNull final CallBack 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:
ChatRoom io.agora.chat.ChatRoomManager.addChatRoomAdmin | ( | String | chatRoomId, |
String | admin | ||
) | throws ChatException |
Adds a chat room admin.
For the asynchronous method, see asyncAddChatRoomAdmin(String, String, ValueCallBack).
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. |
ChatException | A description of the exception. See Error. |
void io.agora.chat.ChatRoomManager.addChatRoomChangeListener | ( | ChatRoomChangeListener | listener | ) |
Adds a chat room event listener.
Chat room event listeners added with this method can be removed by calling removeChatRoomListener(ChatRoomChangeListener).
listener | A chat room event listener. See ChatRoomChangeListener. |
void io.agora.chat.ChatRoomManager.addToChatRoomWhiteList | ( | final String | chatRoomId, |
final List< String > | members, | ||
final ValueCallBack< ChatRoom > | callBack | ||
) |
Adds members to the allow list of the chat room.
When muteAllMembers(String, ValueCallBack) 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 ValueCallBack#onSuccess(Object); if this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncAddChatRoomAdmin | ( | final String | chatRoomId, |
final String | admin, | ||
final ValueCallBack< ChatRoom > | 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 ValueCallBack#onSuccess(Object); if this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncBlockChatroomMembers | ( | final String | chatRoomId, |
final List< String > | members, | ||
final ValueCallBack< ChatRoom > | 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 ValueCallBack#onSuccess(Object); If this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncChangeChatroomDescription | ( | final String | chatRoomId, |
final String | newDescription, | ||
final ValueCallBack< ChatRoom > | 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 ValueCallBack#onSuccess(Object); if this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncChangeChatRoomSubject | ( | final String | chatRoomId, |
final String | newSubject, | ||
final ValueCallBack< ChatRoom > | 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 ValueCallBack#onSuccess(Object); if this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncChangeOwner | ( | final String | chatRoomId, |
final String | newOwner, | ||
final ValueCallBack< ChatRoom > | callBack | ||
) | throws ChatException |
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 ValueCallBack#onSuccess(Object); if this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncCheckIfInMuteList | ( | final String | chatRoomId, |
ValueCallBack< 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 ValueCallBack#onSuccess(Object) to show whether the member is be muted or not; if this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncCreateChatRoom | ( | final String | subject, |
final String | description, | ||
final String | welcomeMessage, | ||
final int | maxUserCount, | ||
final List< String > | members, | ||
final ValueCallBack< ChatRoom > | 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 ValueCallBack#onSuccess(Object); if this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncDestroyChatRoom | ( | final String | chatRoomId, |
final CallBack | 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 CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncFetchChatRoomAllAttributesFromServer | ( | String | chatRoomId, |
@NonNull final ValueCallBack< 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 ValueCallBack#onSuccess(Object); if this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncFetchChatRoomAnnouncement | ( | final String | chatRoomId, |
final ValueCallBack< 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 ValueCallBack#onSuccess(Object) and returns the chat room announcement; if this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncFetchChatroomAttributesFromServer | ( | String | chatRoomId, |
List< String > | keyList, | ||
@NonNull final ValueCallBack< 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 ValueCallBack#onSuccess(Object); if this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncFetchChatRoomBlackList | ( | final String | chatRoomId, |
final int | pageNum, | ||
final int | pageSize, | ||
final ValueCallBack< 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 ValueCallBack#onSuccess(Object) and returns the block list of the chat room; If this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncFetchChatRoomFromServer | ( | final String | roomId, |
final ValueCallBack< ChatRoom > | 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 ValueCallBack#onSuccess(Object); if this call fails, callsValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncFetchChatRoomMembers | ( | final String | chatRoomId, |
final String | cursor, | ||
final int | pageSize, | ||
final ValueCallBack< CursorResult< 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 ValueCallBack#onSuccess(Object); If this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncFetchChatRoomMuteList | ( | final String | chatRoomId, |
final int | pageNum, | ||
final int | pageSize, | ||
final ValueCallBack< 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 ValueCallBack#onSuccess(Object); If this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncFetchPublicChatRoomsFromServer | ( | final int | pageNum, |
final int | pageSize, | ||
final ValueCallBack< PageResult< ChatRoom > > | 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 ValueCallBack#onSuccess(Object). If this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncFetchPublicChatRoomsFromServer | ( | final int | pageSize, |
final String | cursor, | ||
final ValueCallBack< CursorResult< ChatRoom > > | 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 ValueCallBack#onSuccess(Object); If this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncMuteChatRoomMembers | ( | final String | chatRoomId, |
final List< String > | muteMembers, | ||
final long | duration, | ||
final ValueCallBack< ChatRoom > | 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 ValueCallBack#onSuccess(Object); if this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncRemoveChatRoomAdmin | ( | final String | chatRoomId, |
final String | admin, | ||
final ValueCallBack< ChatRoom > | 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 ValueCallBack#onSuccess(Object); if this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncRemoveChatRoomAttributeFromServer | ( | String | chatRoomId, |
String | key, | ||
@NonNull final CallBack | 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 CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncRemoveChatRoomAttributeFromServerForced | ( | String | chatRoomId, |
String | key, | ||
@NonNull final CallBack | 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 CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncRemoveChatRoomAttributesFromServer | ( | String | chatRoomId, |
List< String > | keyList, | ||
@NonNull final ResultCallBack< 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 ResultCallBack#onResult(int,Object); return Object is Map={"k1":703}, A description of the exception. See Error. EXCEED_SERVICE_LIMIT = 4; INVALID_PARAM = 110; QUERY_PARAM_REACHES_LIMIT = 112; CHATROOM_PERMISSION_DENIED = 703; |
void io.agora.chat.ChatRoomManager.asyncRemoveChatRoomAttributesFromServerForced | ( | String | chatRoomId, |
List< String > | keyList, | ||
@NonNull final ResultCallBack< 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 ResultCallBack#onResult(int, Object) (int,Object)}; return Object is Map={"k1":703}, A description of the exception. See Error. EXCEED_SERVICE_LIMIT = 4; INVALID_PARAM = 110; QUERY_PARAM_REACHES_LIMIT = 112; CHATROOM_PERMISSION_DENIED = 703; |
void io.agora.chat.ChatRoomManager.asyncRemoveChatRoomMembers | ( | final String | chatRoomId, |
final List< String > | members, | ||
final ValueCallBack< ChatRoom > | 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 ValueCallBack#onSuccess(Object); if this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncSetChatroomAttribute | ( | String | chatRoomId, |
String | key, | ||
String | value, | ||
boolean | autoDelete, | ||
@NonNull final CallBack | 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 CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncSetChatroomAttributeForced | ( | String | chatRoomId, |
String | key, | ||
String | value, | ||
boolean | autoDelete, | ||
@NonNull final CallBack | 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 CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncSetChatroomAttributes | ( | String | chatRoomId, |
Map< String, String > | attributeMap, | ||
boolean | autoDelete, | ||
@NonNull final ResultCallBack< 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 ResultCallBack#onResult(int, Object); return Object is Map={"k1":703}, A description of the exception. See Error. EXCEED_SERVICE_LIMIT = 4; INVALID_PARAM = 110; QUERY_PARAM_REACHES_LIMIT = 112; CHATROOM_PERMISSION_DENIED = 703; |
void io.agora.chat.ChatRoomManager.asyncSetChatroomAttributesForced | ( | String | chatRoomId, |
Map< String, String > | attributeMap, | ||
boolean | autoDelete, | ||
@NonNull final ResultCallBack< 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 ResultCallBack#onResult(int,Object); return Object is Map={"k1":703}, A description of the exception. See Error. EXCEED_SERVICE_LIMIT = 4; INVALID_PARAM = 110; QUERY_PARAM_REACHES_LIMIT = 112; CHATROOM_PERMISSION_DENIED = 703; |
void io.agora.chat.ChatRoomManager.asyncUnBlockChatRoomMembers | ( | final String | chatRoomId, |
final List< String > | members, | ||
final ValueCallBack< ChatRoom > | 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 ValueCallBack#onSuccess(Object); if this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncUnMuteChatRoomMembers | ( | final String | chatRoomId, |
final List< String > | members, | ||
final ValueCallBack< ChatRoom > | 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 ValueCallBack#onSuccess(Object); if this call fails, calls ValueCallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.asyncUpdateChatRoomAnnouncement | ( | final String | chatRoomId, |
final String | announcement, | ||
final CallBack | 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 CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String). |
ChatRoom io.agora.chat.ChatRoomManager.blockChatroomMembers | ( | String | chatRoomId, |
List< String > | members | ||
) | throws ChatException |
Adds members to the block list of the chat room.
For the asynchronous method, see asyncBlockChatroomMembers(String, List, ValueCallBack).
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. |
ChatException | A description of the exception. See Error. |
ChatRoom io.agora.chat.ChatRoomManager.changeChatroomDescription | ( | String | chatRoomId, |
String | newDescription | ||
) | throws ChatException |
Modifies the chat room description.
For the asynchronous method, see asyncChangeChatroomDescription(String, String, ValueCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
newDescription | The modified chat room description. |
ChatException | A description of the exception. See Error. |
ChatRoom io.agora.chat.ChatRoomManager.changeChatRoomSubject | ( | String | chatRoomId, |
String | newSubject | ||
) | throws ChatException |
Changes the chat room name.
For the asynchronous method, see asyncChangeChatRoomSubject(String, String, ValueCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
newSubject | The modified chat room name. |
ChatException | A description of the exception. See Error |
ChatRoom io.agora.chat.ChatRoomManager.changeOwner | ( | String | chatRoomId, |
String | newOwner | ||
) | throws ChatException |
Transfers the chat room ownership.
For the asynchronous method, see asyncChangeOwner(String, String, ValueCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | A chat room ID. |
newOwner | The new owner of the chat room. |
ChatException | A description of the exception. See Error. |
void io.agora.chat.ChatRoomManager.checkIfInChatRoomWhiteList | ( | final String | chatRoomId, |
ValueCallBack< 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 ValueCallBack#onSuccess(Object) to show whether the member is on the block list; if this call fails, calls ValueCallBack#onError(int, String). |
ChatRoom io.agora.chat.ChatRoomManager.createChatRoom | ( | String | subject, |
String | description, | ||
String | welcomeMessage, | ||
int | maxUserCount, | ||
List< String > | members | ||
) | throws ChatException |
Creates a chat room.
@Note For the asynchronous method, see asyncCreateChatRoom(String, String, String, int, List, ValueCallBack).
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. |
ChatException | A description of the exception. See Error. |
void io.agora.chat.ChatRoomManager.destroyChatRoom | ( | String | chatRoomId | ) | throws ChatException |
Destroys a chat room.
For the asynchronous method, see asyncDestroyChatRoom(String, CallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
ChatException | A description of the exception. See Error. |
String io.agora.chat.ChatRoomManager.fetchChatRoomAnnouncement | ( | String | chatRoomId | ) | throws ChatException |
Gets the chat room announcement from the server.
For the asynchronous method, see asyncFetchChatRoomAnnouncement(String, ValueCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
ChatException | A description of the exception. See Error |
List< String > io.agora.chat.ChatRoomManager.fetchChatRoomBlackList | ( | String | chatRoomId, |
int | pageNum, | ||
int | pageSize | ||
) | throws ChatException |
Gets the chat room block list with pagination.
For the asynchronous method, see asyncFetchChatRoomBlackList(String, int, int, ValueCallBack).
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]. |
ChatException | A description of the exception. See Error. |
ChatRoom io.agora.chat.ChatRoomManager.fetchChatRoomFromServer | ( | String | roomId | ) | throws ChatException |
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, ValueCallBack).
roomId | The chat room ID. |
ChatException | A description of the exception. See Error. |
ChatRoom io.agora.chat.ChatRoomManager.fetchChatRoomFromServer | ( | String | roomId, |
boolean | fetchMembers | ||
) | throws ChatException |
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. |
ChatException | A description of the exception. See Error. |
CursorResult< String > io.agora.chat.ChatRoomManager.fetchChatRoomMembers | ( | String | chatRoomId, |
String | cursor, | ||
int | pageSize | ||
) | throws ChatException |
Gets the chat room member list.
For the asynchronous method, see asyncFetchChatRoomMembers(String, String, int, ValueCallBack).
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]. |
ChatException | A description of the exception. See Error. |
Map< String, Long > io.agora.chat.ChatRoomManager.fetchChatRoomMuteList | ( | String | chatRoomId, |
int | pageNum, | ||
int | pageSize | ||
) | throws ChatException |
Gets the list of muted chat room members from the server.
For the asynchronous method, see asyncFetchChatRoomMuteList(String, int, int, ValueCallBack).
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]. |
ChatException | A description of the exception. See Error. |
void io.agora.chat.ChatRoomManager.fetchChatRoomWhiteList | ( | final String | chatRoomId, |
final ValueCallBack< 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 ValueCallBack#onSuccess(Object); If this call fails, calls ValueCallBack#onError(int, String). |
PageResult< ChatRoom > io.agora.chat.ChatRoomManager.fetchPublicChatRoomsFromServer | ( | int | pageNum, |
int | pageSize | ||
) | throws ChatException |
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, ValueCallBack) 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]. |
ChatException | A description of the exception. See Error. |
CursorResult< ChatRoom > io.agora.chat.ChatRoomManager.fetchPublicChatRoomsFromServer | ( | int | pageSize, |
String | cursor | ||
) | throws ChatException |
Gets chat room data from the server with pagination.
As this method is time-consuming, the asynchronous method asyncFetchPublicChatRoomsFromServer(int, String, ValueCallBack) 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. |
ChatException | A description of the exception. See Error. |
List< ChatRoom > io.agora.chat.ChatRoomManager.getAllChatRooms | ( | ) |
Gets the list of chat rooms in the memory.
ChatRoom io.agora.chat.ChatRoomManager.getChatRoom | ( | String | roomId | ) |
Gets the chat room in the memory.
roomId | The chat room ID. |
void io.agora.chat.ChatRoomManager.joinChatRoom | ( | final String | roomId, |
final ValueCallBack< ChatRoom > | 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 ValueCallBack#onSuccess(Object) and returns the chat room object; if this call fails, calls ValueCallBack#onError(int, String), where the first parameter is the error code and the second is the error message. |
void io.agora.chat.ChatRoomManager.leaveChatRoom | ( | final String | roomId | ) |
Exits a chat room.
This is an asynchronous method.
roomId | The ID of the chat room to exit. |
void io.agora.chat.ChatRoomManager.leaveChatRoom | ( | final String | roomId, |
CallBack | callback | ||
) |
Exits a chat room.
A user that joins a chat room using joinChatRoom(String, ValueCallBack) 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 CallBack#onSuccess(); if this call fails, calls CallBack#onError(int, String). |
void io.agora.chat.ChatRoomManager.muteAllMembers | ( | final String | chatRoomId, |
final ValueCallBack< ChatRoom > | 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 ValueCallBack#onSuccess(Object); if this call fails, calls ValueCallBack#onError(int, String). |
ChatRoom io.agora.chat.ChatRoomManager.muteChatRoomMembers | ( | String | chatRoomId, |
List< String > | muteMembers, | ||
long | duration | ||
) | throws ChatException |
Mutes members in a chat room.
For the asynchronous method, see asyncMuteChatRoomMembers(String, List, long, ValueCallBack).
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. |
ChatException | A description of the exception. See Error. |
ChatRoom io.agora.chat.ChatRoomManager.removeChatRoomAdmin | ( | String | chatRoomId, |
String | admin | ||
) | throws ChatException |
Removes administrative privileges of a chat room admin.
For the asynchronous method, see asyncRemoveChatRoomAdmin(String, String, ValueCallBack).
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. |
ChatException | A description of the exception. See Error. |
void io.agora.chat.ChatRoomManager.removeChatRoomChangeListener | ( | ChatRoomChangeListener | listener | ) |
Removes a chat room event listener.
Currently, removeChatRoomListener(ChatRoomChangeListener) is recommended to remove a chat room event listener.
listener | The chat room listener to be removed. |
void io.agora.chat.ChatRoomManager.removeChatRoomListener | ( | ChatRoomChangeListener | listener | ) |
Removes the chat room event listener.
listener | The chat room event listener to be removed. |
ChatRoom io.agora.chat.ChatRoomManager.removeChatRoomMembers | ( | String | chatRoomId, |
List< String > | members | ||
) | throws ChatException |
Removes members from a chat room.
For the asynchronous method, see asyncRemoveChatRoomMembers(String, List, ValueCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
members | The list of members to be removed. |
ChatException | A description of the exception. See Error. |
void io.agora.chat.ChatRoomManager.removeFromChatRoomWhiteList | ( | final String | chatRoomId, |
final List< String > | members, | ||
final ValueCallBack< ChatRoom > | callBack | ||
) |
Removes members from the chat room block list.
For members removed from the block list, muteAllMembers(String, ValueCallBack) 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 ValueCallBack#onSuccess(Object); if this call fails, calls ValueCallBack#onError(int, String). |
ChatRoom io.agora.chat.ChatRoomManager.unblockChatRoomMembers | ( | String | chatRoomId, |
List< String > | members | ||
) | throws ChatException |
Removes members from the block list of the chat room.
For the asynchronous method, see asyncBlockChatroomMembers(String, List, ValueCallBack).
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. |
ChatException | A description of the exception. See Error. |
void io.agora.chat.ChatRoomManager.unmuteAllMembers | ( | final String | chatRoomId, |
final ValueCallBack< ChatRoom > | callBack | ||
) |
Unmutes all members.
This is an asynchronous method.
chatRoomId | The chat room ID. |
callBack | The completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object); If this call fails, calls ValueCallBack#onError(int, String). |
ChatRoom io.agora.chat.ChatRoomManager.unMuteChatRoomMembers | ( | String | chatRoomId, |
List< String > | members | ||
) | throws ChatException |
Unmutes members in a chat room.
For the asynchronous method, see asyncUnMuteChatRoomMembers(String, List, ValueCallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
members | The list of members to be unmuted. |
ChatException | A description of the exception. See Error. |
void io.agora.chat.ChatRoomManager.updateChatRoomAnnouncement | ( | String | chatRoomId, |
String | announcement | ||
) | throws ChatException |
Updates the chat room announcement.
For the asynchronous method, see asyncUpdateChatRoomAnnouncement(String, String, CallBack).
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
announcement | The modified announcement content. |
ChatException | A description of the exception. See Error. |