agora_chat_SDK 1.0.6
agora java chat SDK
|
Public Member Functions | |
ChatRoomManager (ChatClient client, EMAChatRoomManager manager) | |
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) |
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 | 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) |
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. Only the chat room owner can call this method. 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 ID of the chat room admin to be added. |
ChatException | A description of the exception. See io.agora.Error. |
void io.agora.chat.ChatRoomManager.addChatRoomChangeListener | ( | ChatRoomChangeListener | listener | ) |
Registers a chat room event listener. Chat room destruction, member entry and exit, mute, and allowlist entry addition among other operations can be listened by setting ChatRoomChangeListener.
Chat room event listeners registered with this method can be removed by calling removeChatRoomListener(ChatRoomChangeListener).
listener | A chat room listener. See ChatRoomChangeListener. |
void io.agora.chat.ChatRoomManager.addToChatRoomWhiteList | ( | final String | chatRoomId, |
final List< String > | members, | ||
final ValueCallBack< ChatRoom > | callBack | ||
) |
Adds members to the allowlist. Only the chat room owner or admin can call this method. For members added to the allowlist, muteAllMembers(String, ValueCallBack), when executed by the chat room owner or admin, does not work.
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. Only the chat room owner can call this method. For the asynchronous method, see addChatRoomAdmin(String, String).
This is an asynchronous method.
chatRoomId | The chat room ID. |
admin | The ID of the chat room admin to be added. |
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 chat room's blocklist. Only the chat room owner or admin can call this method. For members added to blacklist, note the following:
This is an asynchronous method.
chatRoomId | The chat room ID. |
members | The list of members to be added to blocklist. |
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. Only the chat room owner can call this method. For the synchronous method, see changeChatroomDescription(String, String).
This is an asynchronous method.
chatRoomId | The chat room ID. |
newDescription | The new description 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.asyncChangeChatRoomSubject | ( | final String | chatRoomId, |
final String | newSubject, | ||
final ValueCallBack< ChatRoom > | callBack | ||
) |
Changes the chat room subject. Only the chat room owner can call this method. For the synchronous method, see changeChatRoomSubject(String, String).
This is an asynchronous method.
chatRoomId | A chat room ID. |
newSubject | The new subject 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.asyncChangeOwner | ( | final String | chatRoomId, |
final String | newOwner, | ||
final ValueCallBack< ChatRoom > | callBack | ||
) | throws ChatException |
Transfers the chat room ownership. Only the chat room owner can call this method. For the synchronous method, see changeOwner(String, String).
This is an asynchronous method.
chatRoomId | The chat room ID. |
newOwner | The ID of the new chat room owner. |
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.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 subject. |
description | The chat room description. |
welcomeMessage | A welcome message inviting members to join the chat room. |
maxUserCount | The maximum number of members allowed to join the chat room. |
members | The list of members 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. Only the chat room owner can call this method. 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.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.asyncFetchChatRoomBlackList | ( | final String | chatRoomId, |
final int | pageNum, | ||
final int | pageSize, | ||
final ValueCallBack< List< String > > | callBack | ||
) |
Gets the chat room blocklist with pagination. 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.
chatRoomId | The chat room ID. |
pageNum | The page number, starting from 1. |
pageSize | The number of users on the blocklist per page. |
callBack | The completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object) and returns the chat room's blocklist; If this call fails, calls ValueCallBack#onError(int, String). Note the following:
|
void io.agora.chat.ChatRoomManager.asyncFetchChatRoomFromServer | ( | final String | roomId, |
final ValueCallBack< ChatRoom > | callback | ||
) |
Gets details of a chat room from the server, excluding the member list by default. For the synchronous method, see fetchChatRoomFromServer(String).
This is an asynchronous method.
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. When CursorResult.getCursor() is an empty string ("") amid the result, all data is fetched.
This is an asynchronous method.
chatRoomId | The chat room ID. |
cursor | The cursor position from which to get data. |
pageSize | The number of members per page. |
callBack | The completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object); If this call fails, calls ValueCallBack#onError(int, String). Note the following:
|
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 members who are muted in the chat room from the server. 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.
chatRoomId | The chat room ID. |
pageNum | The page number, starting from 1. |
pageSize | The number of muted members per page. |
callBack | The completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object); If this call fails, calls ValueCallBack#onError(int, String). Note the following:
|
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 per page. |
callback | The completion callback. If this call succeeds, calls ValueCallBack#onSuccess(Object). If this call fails, calls ValueCallBack#onError(int, String). Note the following:
|
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. When CursorResult.getCursor() is an empty string ("") amid the result, all data is fetched.
This is an asynchronous method.
pageSize | The number of records per page. |
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. 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.
chatRoomId | The chat room ID. |
muteMembers | The list of members to be muted. |
duration | The mute duration in milliseconds. |
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 the privileges of a chat room admin. Only the chat room owner can call this method. For the synchronous method, see removeChatRoomAdmin(String, String).
This is an asynchronous method.
chatRoomId | The chat room ID. |
admin | The ID of admin whose 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.asyncRemoveChatRoomMembers | ( | final String | chatRoomId, |
final List< String > | members, | ||
final ValueCallBack< ChatRoom > | callBack | ||
) |
Removes members from a chat room. Only the chat room owner or admin can call this method. 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.asyncUnBlockChatRoomMembers | ( | final String | chatRoomId, |
final List< String > | members, | ||
final ValueCallBack< ChatRoom > | callBack | ||
) |
Removes members from the chat room's blocklist. Only the chat room owner or admin can call this method. 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 blocklist. |
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. Only the chat room owner or admin can call this method. 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. Only the chat room owner or admin can call this method. For the synchronous method, see updateChatRoomAnnouncement(String, String).
This is an asynchronous method.
chatRoomId | The chat room ID |
announcement | The 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 chat room's blocklist. Only the chat room owner or admin can call this method. For members added to blocklist, note the following:
This is a synchronous method and blocks the current thread.
chatRoomId | The chat room ID. |
members | The list of members to be added to blocklist. |
ChatException | A description of the exception. See io.agora.Error. |
ChatRoom io.agora.chat.ChatRoomManager.changeChatroomDescription | ( | String | chatRoomId, |
String | newDescription | ||
) | throws ChatException |
Modifies the chat room description. Only the chat room owner can call this method. 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 new description of the chat room. |
ChatException | A description of the exception. See io.agora.Error. |
ChatRoom io.agora.chat.ChatRoomManager.changeChatRoomSubject | ( | String | chatRoomId, |
String | newSubject | ||
) | throws ChatException |
Changes the chat room subject. Only the chat room owner can call this method. 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 new subject of the chat room. |
ChatException | A description of the exception. See io.agora.Error |
ChatRoom io.agora.chat.ChatRoomManager.changeOwner | ( | String | chatRoomId, |
String | newOwner | ||
) | throws ChatException |
Transfers the chat room ownership. Only the chat room owner can call this method. 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 ID of the new chat room owner. |
ChatException | A description of the exception. See io.agora.Error. |
void io.agora.chat.ChatRoomManager.checkIfInChatRoomWhiteList | ( | final String | chatRoomId, |
ValueCallBack< Boolean > | callBack | ||
) |
Checks whether the member is on the blocklist.
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 blocklist; 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. 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 subject. |
description | The chat room description. |
welcomeMessage | A welcome message inviting members to join the chat room. |
maxUserCount | The maximum number of members allowed to join the chat room. |
members | The list of members invited to join the chat room. |
ChatException | A description of the exception. See io.agora.Error. |
void io.agora.chat.ChatRoomManager.destroyChatRoom | ( | String | chatRoomId | ) | throws ChatException |
Destroys a chat room. Only the chat room owner can call this method. 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 io.agora.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 blocklist with pagination. Only the chat room owner or admin can call this method. 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 users on the blocklist per page. |
ChatException | A description of the exception. See io.agora.Error. |
Note the following:
ChatRoom io.agora.chat.ChatRoomManager.fetchChatRoomFromServer | ( | String | roomId | ) | throws ChatException |
Gets details of a chat room from the server, excluding the member list by default. For the asynchronous method, see asyncFetchChatRoomFromServer(String, ValueCallBack).
This is a synchronous method and blocks the current thread.
roomId | The chat room ID. |
ChatException | A description of the exception. See io.agora.Error. |
ChatRoom io.agora.chat.ChatRoomManager.fetchChatRoomFromServer | ( | String | roomId, |
boolean | fetchMembers | ||
) | throws ChatException |
Gets details of a chat room from the server. The member list, if required, can contain at most 200 members by default. For more members, call ChatRoomManager#fetchChatRoomMembers(String, String, int).
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 io.agora.Error. |
CursorResult< String > io.agora.chat.ChatRoomManager.fetchChatRoomMembers | ( | String | chatRoomId, |
String | cursor, | ||
int | pageSize | ||
) | throws ChatException |
Gets the chat room member list. When CursorResult.getCursor() is an empty string ("") amid the result, all data is fetched. 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. |
pageSize | The number of members per page. |
ChatException | A description of the exception. See io.agora.Error. Note the following:
|
Map< String, Long > io.agora.chat.ChatRoomManager.fetchChatRoomMuteList | ( | String | chatRoomId, |
int | pageNum, | ||
int | pageSize | ||
) | throws ChatException |
Gets the list of members who are muted in the chat room from the server. Only the chat room owner or admin can call this method. 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 per page. |
ChatException | A description of the exception. See io.agora.Error Note the following:
|
void io.agora.chat.ChatRoomManager.fetchChatRoomWhiteList | ( | final String | chatRoomId, |
final ValueCallBack< List< String > > | callBack | ||
) |
Gets the blocklist from the server. Only the chat room owner or admin can call this method.
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. Also, the asynchronous method asyncFetchPublicChatRoomsFromServer(int, int, ValueCallBack) can be used.
This is a synchronous method and blocks the current thread.
pageNum | The page number, starting from 1. |
pageSize | The number of records per page. |
ChatException | A description of the exception. See io.agora.Error. |
Note the following:
CursorResult< ChatRoom > io.agora.chat.ChatRoomManager.fetchPublicChatRoomsFromServer | ( | int | pageSize, |
String | cursor | ||
) | throws ChatException |
Gets chat room data from the server with pagination. When CursorResult.getCursor() is an empty string ("") amid the result, all data is fetched. 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. |
cursor | The cursor position from which to start getting data. |
ChatException | A description of the exception. See io.agora.Error. |
List< ChatRoom > io.agora.chat.ChatRoomManager.getAllChatRooms | ( | ) |
Gets the list of chat rooms in the cache. Note: Data can be returned upon the call of this method only after one of the following methods is called:
ChatRoom io.agora.chat.ChatRoomManager.getChatRoom | ( | String | roomId | ) |
Gets the chat room in the cache.
roomId | The chat room ID. |
void io.agora.chat.ChatRoomManager.joinChatRoom | ( | final String | roomId, |
final ValueCallBack< ChatRoom > | callback | ||
) |
Joins the chat room. To exit the chat room, call leaveChatRoom(String).
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 | ) |
Leaves a chat room. This method is called for a member to leave a chat room the members joins using joinChatRoom(String, ValueCallBack).
This is an asynchronous method.
roomId | The ID of the chat room to leave. |
void io.agora.chat.ChatRoomManager.muteAllMembers | ( | final String | chatRoomId, |
final ValueCallBack< ChatRoom > | callBack | ||
) |
Mutes all members. Only the chat room owner or admin can call this method. This method does not work for the chat room owner, admin, and members added to the blocklist.
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. Only the chat room owner or admin can call this method. 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. |
ChatException | A description of the exception. See io.agora.Error. |
ChatRoom io.agora.chat.ChatRoomManager.removeChatRoomAdmin | ( | String | chatRoomId, |
String | admin | ||
) | throws ChatException |
Removes privileges of a chat room admin. Only the chat room owner can call this method. 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 ID of admin whose privileges are to be removed. |
ChatException | A description of the exception. See io.agora.Error. |
void io.agora.chat.ChatRoomManager.removeChatRoomChangeListener | ( | ChatRoomChangeListener | listener | ) |
Removes a chat room event listener. This method removes a chat room event listener registered with addChatRoomChangeListener(ChatRoomChangeListener). 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. This method removes the chat room event listener registered with addChatRoomChangeListener(ChatRoomChangeListener).
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. Only the chat room owner or admin can call this method. 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 io.agora.Error. |
void io.agora.chat.ChatRoomManager.removeFromChatRoomWhiteList | ( | final String | chatRoomId, |
final List< String > | members, | ||
final ValueCallBack< ChatRoom > | callBack | ||
) |
Removes members from the blocklist. Only the chat room owner or admin can call this method. For members removed from the blocklist, muteAllMembers(String, ValueCallBack) works.
This is an asynchronous method.
chatRoomId | The chat room ID. |
members | The list of members to be removed from the blocklist. |
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 chat room's blocklist. Only the chat room owner or admin can call this method. 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 blocklist. |
ChatException | A description of the exception. See io.agora.Error. |
void io.agora.chat.ChatRoomManager.unmuteAllMembers | ( | final String | chatRoomId, |
final ValueCallBack< ChatRoom > | callBack | ||
) |
Unmutes all members. Only the chat room owner or admin can call this method.
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. Only the chat room owner or admin can call this method. 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 io.agora.Error. |
void io.agora.chat.ChatRoomManager.updateChatRoomAnnouncement | ( | String | chatRoomId, |
String | announcement | ||
) | throws ChatException |
Updates the chat room announcement. Only the chat room owner or admin can call this method. 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 announcement content. |
ChatException | A description of the exception. See Error. |