agora_chat_SDK  3.8.2
agorajavachatSDK
Public Member Functions | List of all members
io.agora.chat.ChatRoomManager Class Reference

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< ChatRoomfetchPublicChatRoomsFromServer (int pageNum, int pageSize) throws ChatException
 
CursorResult< ChatRoomfetchPublicChatRoomsFromServer (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< ChatRoomgetAllChatRooms ()
 
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)
 

Detailed Description

Chat room manager, responsible for chat room join, exit, list access and member rights management and so on Such as, join a chat room:

  ChatClient.getInstance().chatroomManager().joinChatRoom(conversationId, new ValueCallBack<ChatRoom>() {
    public void onSuccess(ChatRoom value) {
        //Do something after successfully joined the chat room
       }
    public void onError(int error, String errorMsg) {
        //Do something after fail to join the chat room
       }
    });

Member Function Documentation

ChatRoom io.agora.chat.ChatRoomManager.addChatRoomAdmin ( String  chatRoomId,
String  admin 
) throws ChatException

Add chat room administrator Owner‘s authority is required Asynchronously method see asyncAddChatRoomAdmin(String, String, ValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
adminAdmin id to set
Returns
Return the ChatRoom instance modified
Exceptions
ChatExceptionError info, see io.agora.Error
void io.agora.chat.ChatRoomManager.addChatRoomChangeListener ( ChatRoomChangeListener  listener)

Register chat room change listener Chat room destruction, member entry and exit, silence, whitelisting and so on can be listened by setting ChatRoomChangeListener

After calling this method need to call removeChatRoomListener(ChatRoomChangeListener) at the appropriate time to remove the listener

Parameters
listenerChat room listener, see ChatRoomChangeListener
void io.agora.chat.ChatRoomManager.addToChatRoomWhiteList ( final String  chatRoomId,
final List< String >  members,
final ValueCallBack< ChatRoom callBack 
)

Add members to whitelist Owner or administrator‘s authority is required The whitelisted user is not affected when muteAllMembers(String, ValueCallBack) is executed by owner or admins

Asynchronously method

Parameters
chatRoomIdChat room id
membersThe member list to add
callBackResult callback, success call ValueCallBack#onSuccess(Object), failure call ValueCallBack#onError(int, String)
void io.agora.chat.ChatRoomManager.asyncAddChatRoomAdmin ( final String  chatRoomId,
final String  admin,
final ValueCallBack< ChatRoom callBack 
)

Add chat room administrator Owner‘s authority is required Synchronization method see addChatRoomAdmin(String, String)

Asynchronously method

Parameters
chatRoomIdChat room id
adminAdmin id to set
callBackResult callback, success call ValueCallBack#onSuccess(Object), failure call ValueCallBack#onError(int, String)
void io.agora.chat.ChatRoomManager.asyncBlockChatroomMembers ( final String  chatRoomId,
final List< String >  members,
final ValueCallBack< ChatRoom callBack 
)

Add members to chat room's black list Owner or administrator‘s authority is required As member is added to blacklist, have the following behaviors:

1.As member is added to blacklist, will be removed from chat room
2.Call the method ChatRoomChangeListener#onRemovedFromChatRoom(int, String, String, String) to notice,
  the first parameter is the reason, which is EMAChatRoomManagerListener#BE_KICKED
3.The members have been added to blacklist are barred from rejoining

Synchronization method see blockChatroomMembers(String, List)

Asynchronously method

Parameters
chatRoomIdChat room id
membersThe member list to be added to blacklist
callBackResult callback, success call ValueCallBack#onSuccess(Object), failure call ValueCallBack#onError(int, String)
void io.agora.chat.ChatRoomManager.asyncChangeChatroomDescription ( final String  chatRoomId,
final String  newDescription,
final ValueCallBack< ChatRoom callBack 
)

Change chat room description Owner‘s authority is required Synchronization method see changeChatroomDescription(String, String)

Asynchronously method

Parameters
chatRoomIdChat room id
newDescriptionNew description of chat room
callBackResult callback, success call ValueCallBack#onSuccess(Object), failure call ValueCallBack#onError(int, String)
void io.agora.chat.ChatRoomManager.asyncChangeChatRoomSubject ( final String  chatRoomId,
final String  newSubject,
final ValueCallBack< ChatRoom callBack 
)

Change chat room subject Owner‘s authority is required Synchronization method see changeChatRoomSubject(String, String)

Asynchronously method

Parameters
chatRoomIdChat room id
newSubjectNew name of chat room
callBackResult callback, success call ValueCallBack#onSuccess(Object), failure call ValueCallBack#onError(int, String)
void io.agora.chat.ChatRoomManager.asyncChangeOwner ( final String  chatRoomId,
final String  newOwner,
final ValueCallBack< ChatRoom callBack 
) throws ChatException

Transfer chat room ownership to others Owner‘s authority is required Synchronization method see changeOwner(String, String)

Asynchronously method

Parameters
chatRoomIdChat room id
newOwnerNew owner id
callBackResult callback, success call ValueCallBack#onSuccess(Object), failure call 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 
)

Create chat room Synchronization method see createChatRoom(String, String, String, int, List)

Asynchronously method

Parameters
subjectName of chat room
descriptionDescription of chat room
welcomeMessageWelcome message inviting members to join the chat room
maxUserCountMaximum number of members allowed to join
membersMembers inviting to join
callBackResult callback, success call ValueCallBack#onSuccess(Object), failure call ValueCallBack#onError(int, String)
void io.agora.chat.ChatRoomManager.asyncDestroyChatRoom ( final String  chatRoomId,
final CallBack  callBack 
)

Destroy chat room Owner‘s authority is required Synchronization method see destroyChatRoom(String)

Asynchronously method

Parameters
chatRoomIdChat room id
callBackResult callback, success call CallBack#onSuccess(), failure call CallBack#onError(int, String)
void io.agora.chat.ChatRoomManager.asyncFetchChatRoomAnnouncement ( final String  chatRoomId,
final ValueCallBack< String >  callBack 
)

Get the chat room announcement from server

Parameters
chatRoomIdChat room id
callBackResult callback, success call ValueCallBack#onSuccess(Object), return the chat room announcement; failure call ValueCallBack#onError(int, String)
void io.agora.chat.ChatRoomManager.asyncFetchChatRoomBlackList ( final String  chatRoomId,
final int  pageNum,
final int  pageSize,
final ValueCallBack< List< String >>  callBack 
)

Fetch chat room black list members in pages Owner or administrator‘s authority is required Synchronization method see fetchChatRoomBlackList(String, int, int)

Asynchronously method

Parameters
chatRoomIdChat room id
pageNumPage number, start from 1
pageSizeSize to be fetched per page
callBackResult callback, success call ValueCallBack#onSuccess(Object), return the blacklist in chat room; failure call ValueCallBack#onError(int, String)
void io.agora.chat.ChatRoomManager.asyncFetchChatRoomFromServer ( final String  roomId,
final ValueCallBack< ChatRoom callback 
)

Fetch the chat room from server by room id, default not to fetch members Synchronization method see fetchChatRoomFromServer(String)

Asynchronously method

Parameters
roomIdChat room id
callbackResult callback, success call ValueCallBack#onSuccess(Object), failure call ValueCallBack#onError(int, String)
void io.agora.chat.ChatRoomManager.asyncFetchChatRoomMembers ( final String  chatRoomId,
final String  cursor,
final int  pageSize,
final ValueCallBack< CursorResult< String >>  callBack 
)

Fetch chat room member list When CursorResult.getCursor() is an empty string ("") in the result, there is no more data

Asynchronously method

Parameters
chatRoomIdChat room id
cursorThe cursor position to fetch data
pageSizeThe count fetched a time
callBackResult callback, success call ValueCallBack#onSuccess(Object), failure call 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 
)

Fetch mute list from server, which contains mute members and mute time Owner or administrator‘s authority is required Synchronization method see fetchChatRoomMuteList(String, int, int)

Asynchronously method

Parameters
chatRoomIdChat room id
pageNumThe count fetched a time
pageSizeThe cursor position to fetch data
callBackResult callback, success call ValueCallBack#onSuccess(Object), failure call ValueCallBack#onError(int, String)
void io.agora.chat.ChatRoomManager.asyncFetchPublicChatRoomsFromServer ( final int  pageSize,
final String  cursor,
final ValueCallBack< CursorResult< ChatRoom >>  callback 
)

Fetch the chat rooms in page When CursorResult.getCursor() is an empty string ("") in the result, there is no more data

Asynchronously method

Parameters
pageSizeThe count fetched a time
cursorThe cursor position to fetch data
callbackResult callback, success call ValueCallBack#onSuccess(Object), failure call ValueCallBack#onError(int, String)
Deprecated:
Use asyncFetchPublicChatRoomsFromServer(int, int, ValueCallBack) instead
void io.agora.chat.ChatRoomManager.asyncFetchPublicChatRoomsFromServer ( final int  pageNum,
final int  pageSize,
final ValueCallBack< PageResult< ChatRoom >>  callback 
)

Fetch the chat rooms in page

Asynchronously method

Parameters
pageNumPage number, start from 1
pageSizeSize to be fetched per page
callbackResult callback, success call ValueCallBack#onSuccess(Object), failure call ValueCallBack#onError(int, String)
void io.agora.chat.ChatRoomManager.asyncMuteChatRoomMembers ( final String  chatRoomId,
final List< String >  muteMembers,
final long  duration,
final ValueCallBack< ChatRoom callBack 
)

Stop members post message for some time Owner or administrator‘s authority is required Synchronization method see muteChatRoomMembers(String, List, long)

Asynchronously method

Parameters
chatRoomIdChat room id
muteMembersMute members list
durationMute duration, in milli-seconds
callBackResult callback, success call ValueCallBack#onSuccess(Object), failure call ValueCallBack#onError(int, String)
void io.agora.chat.ChatRoomManager.asyncRemoveChatRoomAdmin ( final String  chatRoomId,
final String  admin,
final ValueCallBack< ChatRoom callBack 
)

Remove administrator's authority in chat room Owner‘s authority is required Synchronization method see removeChatRoomAdmin(String, String)

Asynchronously method

Parameters
chatRoomIdChat room id
adminAdmin id to remove
callBackResult callback, success call ValueCallBack#onSuccess(Object), failure call ValueCallBack#onError(int, String)
void io.agora.chat.ChatRoomManager.asyncRemoveChatRoomMembers ( final String  chatRoomId,
final List< String >  members,
final ValueCallBack< ChatRoom callBack 
)

Remove chat room members Owner or administrator‘s authority is required Synchronization method see removeChatRoomMembers(String, List)

Asynchronously method

Parameters
chatRoomIdChat room id
membersThe members list to be removed
callBackResult callback, success call ValueCallBack#onSuccess(Object), failure call ValueCallBack#onError(int, String)
void io.agora.chat.ChatRoomManager.asyncUnBlockChatRoomMembers ( final String  chatRoomId,
final List< String >  members,
final ValueCallBack< ChatRoom callBack 
)

Remove members from chat room's black list Owner or administrator‘s authority is required Synchronization method see unblockChatRoomMembers(String, List)

Asynchronously method

Parameters
chatRoomIdChat room id
membersThe members list will be removed from blacklist
callBackResult callback, success call ValueCallBack#onSuccess(Object), failure call ValueCallBack#onError(int, String)
void io.agora.chat.ChatRoomManager.asyncUnMuteChatRoomMembers ( final String  chatRoomId,
final List< String >  members,
final ValueCallBack< ChatRoom callBack 
)

Release mute Owner or administrator‘s authority is required Synchronization method see unMuteChatRoomMembers(String, List)

Asynchronously method

Parameters
chatRoomIdChat room id
membersRelease mute members list
callBackResult callback, success call ValueCallBack#onSuccess(Object), failure call ValueCallBack#onError(int, String)
void io.agora.chat.ChatRoomManager.asyncUpdateChatRoomAnnouncement ( final String  chatRoomId,
final String  announcement,
final CallBack  callBack 
)

Update chat room announcement Owner or administrator‘s authority is required Synchronization method see updateChatRoomAnnouncement(String, String)

Asynchronously method

Parameters
chatRoomIdChat room id
announcementAnnouncement content
callBackResult callback, success call CallBack#onSuccess(), failure call CallBack#onError(int, String)
ChatRoom io.agora.chat.ChatRoomManager.blockChatroomMembers ( String  chatRoomId,
List< String >  members 
) throws ChatException

Add members to chat room's black list Owner or administrator‘s authority is required As member is added to blacklist, have the following behaviors:

1.As member is added to blacklist, will be removed from chat room
2.Call the method ChatRoomChangeListener#onRemovedFromChatRoom(int, String, String, String) to notice,
  the first parameter is the reason, which is EMAChatRoomManagerListener#BE_KICKED
3.The members have been added to blacklist are barred from rejoining

Asynchronously method see asyncBlockChatroomMembers(String, List, ValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
membersThe member list to be added to blacklist
Returns
Return the ChatRoom instance modified
Exceptions
ChatExceptionError info, see io.agora.Error
ChatRoom io.agora.chat.ChatRoomManager.changeChatroomDescription ( String  chatRoomId,
String  newDescription 
) throws ChatException

change chat room description Owner‘s authority is required Asynchronously method see asyncChangeChatroomDescription(String, String, ValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
newDescriptionNew description of chat room
Returns
Return the ChatRoom instance modified
Exceptions
ChatExceptionError info, see io.agora.Error
ChatRoom io.agora.chat.ChatRoomManager.changeChatRoomSubject ( String  chatRoomId,
String  newSubject 
) throws ChatException

Change chat room subject Owner‘s authority is required Asynchronously method see asyncChangeChatRoomSubject(String, String, ValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
newSubjectNew name of chat room
Returns
Return the ChatRoom instance modified
Exceptions
ChatExceptionError info, see io.agora.Error
ChatRoom io.agora.chat.ChatRoomManager.changeOwner ( String  chatRoomId,
String  newOwner 
) throws ChatException

Transfer chat room ownership to others Owner‘s authority is required Asynchronously method see asyncChangeOwner(String, String, ValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
newOwnerNew owner id
Returns
Return the ChatRoom instance modified
Exceptions
ChatExceptionError info, see io.agora.Error
void io.agora.chat.ChatRoomManager.checkIfInChatRoomWhiteList ( final String  chatRoomId,
ValueCallBack< Boolean >  callBack 
)

Check if in whitelist

Asynchronously method

Parameters
chatRoomIdchat room id
callBackResult callback, success call ValueCallBack#onSuccess(Object), return the result if in whitelist failure call ValueCallBack#onError(int, String)
ChatRoom io.agora.chat.ChatRoomManager.createChatRoom ( String  subject,
String  description,
String  welcomeMessage,
int  maxUserCount,
List< String >  members 
) throws ChatException

Create chat room

Synchronization method will block the current thread

Parameters
subjectName of chat room
descriptionDescription of chat room
welcomeMessageWelcome message inviting members to join the chat room
maxUserCountMaximum number of members allowed to join
membersMembers inviting to join
Returns
ChatRoom ChatRoom instance created successful
Exceptions
ChatExceptionError info, see io.agora.Error
void io.agora.chat.ChatRoomManager.destroyChatRoom ( String  chatRoomId) throws ChatException

Destroy chat room Owner‘s authority is required Asynchronously method see asyncDestroyChatRoom(String, CallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
Exceptions
ChatExceptionError info, see io.agora.Error
String io.agora.chat.ChatRoomManager.fetchChatRoomAnnouncement ( String  chatRoomId) throws ChatException

Get the chat room announcement from server

Parameters
chatRoomIdChat room id
Returns
Chat room announcement
Exceptions
ChatExceptionError info, see io.agora.Error
List<String> io.agora.chat.ChatRoomManager.fetchChatRoomBlackList ( String  chatRoomId,
int  pageNum,
int  pageSize 
) throws ChatException

Fetch chat room black list members in pages Owner or administrator‘s authority is required Asynchronously method see asyncFetchChatRoomBlackList(String, int, int, ValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
pageNumPage number, start from 1
pageSizeSize to be fetched per page
Returns
Return the blacklist in chat room
Exceptions
ChatExceptionError info, see io.agora.Error
ChatRoom io.agora.chat.ChatRoomManager.fetchChatRoomFromServer ( String  roomId) throws ChatException

Fetch the chat room from server by room id, default not to fetch members Asynchronous method see asyncFetchChatRoomFromServer(String, ValueCallBack)

Synchronization method will block the current thread

Parameters
roomIdChat room id
Returns
ChatRoom Return the ChatRoom instance
Exceptions
ChatExceptionError code, see io.agora.Error
ChatRoom io.agora.chat.ChatRoomManager.fetchChatRoomFromServer ( String  roomId,
boolean  fetchMembers 
) throws ChatException

Fetch the chat room from server by room id. If fetchMembers is true, default maximum of fetched member count is 200, to continue fetch members, call ChatRoomManager#fetchChatRoomMembers(String, String, int)

Synchronization method will block the current thread

Parameters
roomIdchat room id
fetchMembersWhether you need to get chat room members
Returns
ChatRoom Return the ChatRoom instance
Exceptions
ChatExceptionError code, see io.agora.Error
CursorResult<String> io.agora.chat.ChatRoomManager.fetchChatRoomMembers ( String  chatRoomId,
String  cursor,
int  pageSize 
) throws ChatException

Fetch chat room member list When CursorResult.getCursor() is an empty string ("") in the result, there is no more data As the synchronization method, can use asynchronous method asyncFetchChatRoomMembers(String, String, int, ValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
cursorThe cursor position to fetch data
pageSizeThe count fetched a time
Returns
Fetch result, see CursorResult
Exceptions
ChatExceptionError info, see io.agora.Error
Map<String, Long> io.agora.chat.ChatRoomManager.fetchChatRoomMuteList ( String  chatRoomId,
int  pageNum,
int  pageSize 
) throws ChatException

Fetch mute list from server, which contains mute members and mute time Owner or administrator‘s authority is required Asynchronously method see asyncFetchChatRoomMuteList(String, int, int, ValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
pageNumThe count fetched a time
pageSizeThe cursor position to fetch data
Returns
Return a map which contains the mute member id and mute duration, in which the key of each entry is the mute member id and the value is the expired time of banning post action, in milli-seconds
Exceptions
ChatExceptionError info, see io.agora.Error
void io.agora.chat.ChatRoomManager.fetchChatRoomWhiteList ( final String  chatRoomId,
final ValueCallBack< List< String >>  callBack 
)

Fetch whitelist from server Owner or administrator‘s authority is required

Asynchronously method

Parameters
chatRoomIdChat room id
callBackResult callback, success call ValueCallBack#onSuccess(Object), failure call ValueCallBack#onError(int, String)
PageResult<ChatRoom> io.agora.chat.ChatRoomManager.fetchPublicChatRoomsFromServer ( int  pageNum,
int  pageSize 
) throws ChatException

Fetch the chat room data in page As the synchronization method, can use asynchronous method asyncFetchPublicChatRoomsFromServer(int, int, ValueCallBack)

Synchronization method will block the current thread

Parameters
pageNumPage number, start from 1
pageSizeSize to be fetched per page
Returns
Fetch result, PageResult
Exceptions
ChatExceptionError code see io.agora.Error
CursorResult<ChatRoom> io.agora.chat.ChatRoomManager.fetchPublicChatRoomsFromServer ( int  pageSize,
String  cursor 
) throws ChatException

Fetch the chat rooms in page When CursorResult.getCursor() is an empty string ("") in the result, there is no more data As the synchronization method, can use asynchronous method asyncFetchPublicChatRoomsFromServer(int, String, ValueCallBack)

Synchronization method will block the current thread

Parameters
pageSizeThe count fetched a time
cursorThe cursor position to fetch data
Returns
Fetch result, see CursorResult
Exceptions
ChatExceptionError code, see io.agora.Error
Deprecated:
Use fetchPublicChatRoomsFromServer(int, int) instead
List<ChatRoom> io.agora.chat.ChatRoomManager.getAllChatRooms ( )

Get all chat rooms in the cache in ChatRoomManager

Returns
Return all the chat rooms maintained by ChatRoomManager
ChatRoom io.agora.chat.ChatRoomManager.getChatRoom ( String  roomId)

Get the chat room in the cache

Parameters
roomIdChat room id
Returns
Return the ChatRoom instance and return null if not find in the cache
void io.agora.chat.ChatRoomManager.joinChatRoom ( final String  roomId,
final ValueCallBack< ChatRoom callback 
)

Join the chat room Leave chat room call leaveChatRoom(String)

Asynchronously method

Parameters
roomIdChat room id to join
callbackCallback for success or fail. If join chat room success calls ValueCallBack#onSuccess(Object), return the ChatRoom instance; Failed to join chat room calls ValueCallBack#onError(int, String), where the first parameter is the error code, the second is the error message
void io.agora.chat.ChatRoomManager.leaveChatRoom ( final String  roomId)

Leave the chat room After join chat room joinChatRoom(String, ValueCallBack), you need to call this method if want to leave chat room

Asynchronously method

Parameters
roomIdChat room id to leave
void io.agora.chat.ChatRoomManager.muteAllMembers ( final String  chatRoomId,
final ValueCallBack< ChatRoom callBack 
)

Mute all members Owner or administrator‘s authority is required Chat room owners, administrators and whitelisted users will not be affected

Asynchronously method

Parameters
chatRoomIdChat room id
callBackResult callback, success call ValueCallBack#onSuccess(Object), failure call ValueCallBack#onError(int, String)
ChatRoom io.agora.chat.ChatRoomManager.muteChatRoomMembers ( String  chatRoomId,
List< String >  muteMembers,
long  duration 
) throws ChatException

Stop members post messages for some time Owner or administrator‘s authority is required Asynchronously method see asyncMuteChatRoomMembers(String, List, long, ValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
muteMembersMute member list
durationMute duration, in milli-seconds
Returns
Return the ChatRoom instance modified
Exceptions
ChatExceptionError info, see io.agora.Error
ChatRoom io.agora.chat.ChatRoomManager.removeChatRoomAdmin ( String  chatRoomId,
String  admin 
) throws ChatException

Remove administrator's authority in chat room Owner‘s authority is required Asynchronously method see asyncRemoveChatRoomAdmin(String, String, ValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
adminAdmin id to remove
Returns
Return the ChatRoom instance modified
Exceptions
ChatExceptionError info, see io.agora.Error
void io.agora.chat.ChatRoomManager.removeChatRoomChangeListener ( ChatRoomChangeListener  listener)

Remove chat room change listener After calling addChatRoomChangeListener(ChatRoomChangeListener) can call this method to remove listener, now it is recommended to use removeChatRoomListener(ChatRoomChangeListener) to remove

Parameters
listenerThe chat room listener to be removed
Deprecated:
Use ChatRoomManager#removeChatRoomListener(ChatRoomChangeListener) instead
void io.agora.chat.ChatRoomManager.removeChatRoomListener ( ChatRoomChangeListener  listener)

Remove chat room change listener After calling addChatRoomChangeListener(ChatRoomChangeListener) need to call this method to remove listener

Parameters
listenerThe chat room listener to be removed
ChatRoom io.agora.chat.ChatRoomManager.removeChatRoomMembers ( String  chatRoomId,
List< String >  members 
) throws ChatException

Remove chat room members Owner or administrator‘s authority is required Asynchronously method see asyncRemoveChatRoomMembers(String, List, ValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
membersThe members list to be removed
Returns
Return the ChatRoom instance modified
Exceptions
ChatExceptionError info, see io.agora.Error
void io.agora.chat.ChatRoomManager.removeFromChatRoomWhiteList ( final String  chatRoomId,
final List< String >  members,
final ValueCallBack< ChatRoom callBack 
)

Remove members from whitelist Owner or administrator‘s authority is required When members are removed from whitelist, they are affected by muteAllMembers(String, ValueCallBack)

Asynchronously method

Parameters
chatRoomIdChat room id
membersThe member list to remove from whitelist
callBack
ChatRoom io.agora.chat.ChatRoomManager.unblockChatRoomMembers ( String  chatRoomId,
List< String >  members 
) throws ChatException

Remove members from chat room's black list Owner or administrator‘s authority is required Asynchronously method see asyncBlockChatroomMembers(String, List, ValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
membersThe members list will be removed from blacklist
Returns
Return the ChatRoom instance modified
Exceptions
ChatExceptionError info, see io.agora.Error
void io.agora.chat.ChatRoomManager.unmuteAllMembers ( final String  chatRoomId,
final ValueCallBack< ChatRoom callBack 
)

Release the mute status of all members Owner or administrator‘s authority is required

Asynchronously method

Parameters
chatRoomIdChat room id
callBackResult callback, success call ValueCallBack#onSuccess(Object), failure call ValueCallBack#onError(int, String)
ChatRoom io.agora.chat.ChatRoomManager.unMuteChatRoomMembers ( String  chatRoomId,
List< String >  members 
) throws ChatException

Release mute Owner or administrator‘s authority is required Asynchronously method see asyncUnMuteChatRoomMembers(String, List, ValueCallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
membersRelease mute members list
Returns
Return the ChatRoom instance modified
Exceptions
ChatExceptionError info, see io.agora.Error
void io.agora.chat.ChatRoomManager.updateChatRoomAnnouncement ( String  chatRoomId,
String  announcement 
) throws ChatException

Update chat room announcement Owner or administrator‘s authority is required Asynchronously method see asyncUpdateChatRoomAnnouncement(String, String, CallBack)

Synchronization method will block the current thread

Parameters
chatRoomIdChat room id
announcementAnnouncement content
Exceptions
ChatExceptionError info, see io.agora.Error

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