Chat SDK for Android v1.2.1
agora java chat SDK
|
Public Member Functions | |
void | addContact (String username, String reason) throws ChatException |
void | asyncAddContact (final String username, final String reason, final CallBack callback) |
void | deleteContact (String username) throws ChatException |
void | deleteContact (String username, boolean keepConversation) throws ChatException |
void | asyncDeleteContact (final String username, final CallBack callback) |
List< String > | getAllContactsFromServer () throws ChatException |
void | asyncGetAllContactsFromServer (final ValueCallBack< List< String > > callback) |
void | setContactListener (ContactListener contactListener) |
void | removeContactListener (ContactListener contactListener) |
void | addUserToBlackList (String username, boolean both) throws ChatException |
void | asyncAddUserToBlackList (final String username, final boolean both, final CallBack callback) |
void | saveBlackList (List< String > blackList) throws ChatException |
void | asyncSaveBlackList (final List< String > blackList, final CallBack callback) |
void | removeUserFromBlackList (String username) throws ChatException |
void | asyncRemoveUserFromBlackList (final String username, final CallBack callback) |
List< String > | getBlackListUsernames () |
List< String > | getBlackListFromServer () throws ChatException |
void | asyncGetBlackListFromServer (final ValueCallBack< List< String > > callback) |
void | acceptInvitation (String username) throws ChatException |
void | asyncAcceptInvitation (final String username, final CallBack callback) |
void | declineInvitation (String username) throws ChatException |
void | asyncDeclineInvitation (final String username, final CallBack callback) |
List< String > | getContactsFromLocal () throws ChatException |
List< String > | getSelfIdsOnOtherPlatform () throws ChatException |
void | asyncGetSelfIdsOnOtherPlatform (final ValueCallBack< List< String > > callback) |
The ContactManager
is used to record, query, and modify contacts.
void io.agora.chat.ContactManager.acceptInvitation | ( | String | username | ) | throws ChatException |
Accepts a friend invitation。
This is a synchronous method and blocks the current thread.
Reference: For the asynchronous method, see asyncAcceptInvitation(String, CallBack)
username | The user who initiates the friend request. |
void io.agora.chat.ContactManager.addContact | ( | String | username, |
String | reason | ||
) | throws ChatException |
Adds a new contact.
This is a synchronous method and blocks the current thread.
Reference: For the asynchronous method, see asyncAddContact(String, String, CallBack).
username | The user to be added. |
reason | (optional) The invitation message. Set the parameter as null if you want to ignore the information. |
ChatException | A description of the issue that caused this exception. |
void io.agora.chat.ContactManager.addUserToBlackList | ( | String | username, |
boolean | both | ||
) | throws ChatException |
Adds a user to blocklist. You can send message to the user in blocklist, but you can not receive the message sent by the other.
Reference: For the asynchronous method, see asyncAddUserToBlackList(String, boolean, CallBack). Adds the batch blocklist by calling saveBlackList(List).
This is a synchronous method and blocks the current thread.
username | The user to be blocked. |
both | This parameter is deprecated. |
ChatException | A description of the issue that caused the exception. |
void io.agora.chat.ContactManager.asyncAcceptInvitation | ( | final String | username, |
final CallBack | callback | ||
) |
Accepts a friend invitation.
This an asynchronous method.
Reference: For the synchronous method, see acceptInvitation(String).
username | The user who initiates the friend request. |
callback | Returns Success if the call succeed and the description of the cause if the call fails. |
void io.agora.chat.ContactManager.asyncAddContact | ( | final String | username, |
final String | reason, | ||
final CallBack | callback | ||
) |
Adds a new contact.
This is an asynchronous method.
Reference: For the synchronous method, see addContact(String, String)
username | The user ID of the contact to be added. |
reason | The message for adding contact (optional). |
callback | The result of the method, which contains the error information if the method fails. |
void io.agora.chat.ContactManager.asyncAddUserToBlackList | ( | final String | username, |
final boolean | both, | ||
final CallBack | callback | ||
) |
Adds the user to blocklist. You can send message to the user in the blocklist, but you can not receive the message sent by the user in the blocklist.
Reference: For the synchronous method, see addUserToBlackList(String, boolean). If you want to add multiple users in a batch to the blocklist, see asyncSaveBlackList(List, CallBack).
username | The user to be blocked. |
both | This parameter is deprecated. |
callback | The callback completion.
|
void io.agora.chat.ContactManager.asyncDeclineInvitation | ( | final String | username, |
final CallBack | callback | ||
) |
Declines a friend invitation.
This an asynchronous method.
Reference: For the synchronous method, see declineInvitation(String).
username | The user who initiates the friend request. |
callback | Returns Success if the call succeed and the description of the cause if the call fails. |
void io.agora.chat.ContactManager.asyncDeleteContact | ( | final String | username, |
final CallBack | callback | ||
) |
Deletes a contact.
This is an asynchronous method.
Reference: For the synchronous method, see deleteContact(String).
username | The contact‘s user ID to be deleted. |
callback | The result of the method, which contains the error information if the method fails. |
void io.agora.chat.ContactManager.asyncGetAllContactsFromServer | ( | final ValueCallBack< List< String > > | callback | ) |
Get all contacts from the server.
Reference: This is a synchronous method see getAllContactsFromServer().
callback | If the method call succeeds, returns the list of contacts; if the method call fails, returns the error information. |
void io.agora.chat.ContactManager.asyncGetBlackListFromServer | ( | final ValueCallBack< List< String > > | callback | ) |
Gets the blocklist from the server.
Reference: For the synchronous method, see getBlackListFromServer().
callback | Returns the blocklist if the call succeed and the description of the cause if the call fails. |
void io.agora.chat.ContactManager.asyncGetSelfIdsOnOtherPlatform | ( | final ValueCallBack< List< String > > | callback | ) |
Get the unique selfID list of the current user on the other devices. The selfID contains username + "/" + resource(the device ID).
This is an asynchronous method.
Reference: For the synchronous method, see getSelfIdsOnOtherPlatform().
callback | - Returns the unique selfID list on the other devices if the method succeeds.
|
void io.agora.chat.ContactManager.asyncRemoveUserFromBlackList | ( | final String | username, |
final CallBack | callback | ||
) |
Removes the contact from the blocklist.
Reference: For the synchronous method, see removeUserFromBlackList(String).
username | The user to be removed from the blocklist. |
callback | The completion callback.
|
void io.agora.chat.ContactManager.asyncSaveBlackList | ( | final List< String > | blackList, |
final CallBack | callback | ||
) |
Uploads the blocklist to server.
Reference: For the synchronous method, see saveBlackList(List).
blackList | The blocklist. |
callback | The completion callback.
|
void io.agora.chat.ContactManager.declineInvitation | ( | String | username | ) | throws ChatException |
Declines a friend invitation.
This is a synchronous method and blocks the current thread.
Reference: For the asynchronous method, see asyncDeclineInvitation(String, CallBack).
username | The user who initiates the invitation. |
void io.agora.chat.ContactManager.deleteContact | ( | String | username | ) | throws ChatException |
Deletes a contact and all the conversations associated.
This is a synchronous method and blocks the current thread.
username | The contact to be deleted. |
ChatException | A description of the issue that caused the exception. |
void io.agora.chat.ContactManager.deleteContact | ( | String | username, |
boolean | keepConversation | ||
) | throws ChatException |
Deletes a contact.
This is a synchronous method and blocks the current thread.
username | The user ID. |
keepConversation | Whether to keep the associated conversation and messages. |
ChatException | A description of the issue that caused the exception. |
List< String > io.agora.chat.ContactManager.getAllContactsFromServer | ( | ) | throws ChatException |
Get all contacts from the server.
This is a synchronous method and blocks the current thread.
Reference: For the asynchronous method, see asyncGetAllContactsFromServer(ValueCallBack).
ChatException | A description of the exception. |
List< String > io.agora.chat.ContactManager.getBlackListFromServer | ( | ) | throws ChatException |
Gets the blocklist from the server.
Reference: For the asynchronous method, see asyncGetBlackListFromServer(ValueCallBack).
This is a synchronous method and blocks the current thread.
ChatException | A description of the issue that caused the exception. |
List< String > io.agora.chat.ContactManager.getBlackListUsernames | ( | ) |
Gets the local blocklist.
List< String > io.agora.chat.ContactManager.getContactsFromLocal | ( | ) | throws ChatException |
Gets the contact list from the local database.
ChatException | A description of the issue that caused the exception. |
List< String > io.agora.chat.ContactManager.getSelfIdsOnOtherPlatform | ( | ) | throws ChatException |
Get the unique IDs of current user on the other devices. The ID is username + "/" + resource.
This is a synchronous method and blocks the current thread.
Reference: For the asynchronous method, see asyncGetSelfIdsOnOtherPlatform(ValueCallBack).
ChatException | A description of the issue that caused this call to fail. |
void io.agora.chat.ContactManager.removeContactListener | ( | ContactListener | contactListener | ) |
Removes the contact listener.
Reference: Adds the contact listener by calling setContactListener(ContactListener).
void io.agora.chat.ContactManager.removeUserFromBlackList | ( | String | username | ) | throws ChatException |
Removes the contact from the blocklist.
Reference: For the asynchronous method, see asyncRemoveUserFromBlackList(String, CallBack).
This is a synchronous method and blocks the current thread.
username | The user to be removed from the blocklist. |
ChatException | A description of the exception. |
void io.agora.chat.ContactManager.saveBlackList | ( | List< String > | blackList | ) | throws ChatException |
Uploads the blocklist to server.
This is a synchronous method and blocks the current thread.
Reference: For the asynchronous method, see asyncSaveBlackList(List, CallBack).
blackList | The blocklist. |
void io.agora.chat.ContactManager.setContactListener | ( | ContactListener | contactListener | ) |
Registers a new contact listener.
Reference: Call removeContactListener(ContactListener) to remove the listener.
contactListener | The contact listener to be registered. |