Public Member Functions | |
abstract void | release () |
abstract void | login (@Nullable String token, @NonNull String userId, @Nullable ResultCallback< Void > resultCallback) |
abstract void | logout (@Nullable ResultCallback< Void > resultCallback) |
abstract RtmMessage | createMessage () |
abstract RtmMessage | createMessage (String text) |
abstract RtmMessage | createMessage (byte[] data) |
abstract RtmMessage | createMessage (byte[] data, String description) |
abstract RtmFileMessage | createFileMessageByMediaId (@NonNull String mediaId) |
abstract RtmImageMessage | createImageMessageByMediaId (@NonNull String mediaId) |
abstract void | createFileMessageByUploading (@NonNull String filePath, RtmRequestId requestId, ResultCallback< RtmFileMessage > resultCallback) |
abstract void | createImageMessageByUploading (@NonNull String filePath, RtmRequestId requestId, ResultCallback< RtmImageMessage > resultCallback) |
abstract void | downloadMediaToMemory (@NonNull String mediaId, RtmRequestId requestId, ResultCallback< byte[]> resultCallback) |
abstract void | downloadMediaToFile (@NonNull String mediaId, @NonNull String filePath, RtmRequestId requestId, ResultCallback< Void > resultCallback) |
abstract void | cancelMediaUpload (RtmRequestId requestId, ResultCallback< Void > resultCallback) |
abstract void | cancelMediaDownload (RtmRequestId requestId, ResultCallback< Void > resultCallback) |
abstract void | sendMessageToPeer (@NonNull String peerId, @NonNull RtmMessage message, @Nullable ResultCallback< Void > resultCallback) |
abstract void | sendMessageToPeer (@NonNull String peerId, @NonNull RtmMessage message, @NonNull SendMessageOptions options, @Nullable ResultCallback< Void > resultCallback) |
abstract RtmChannel | createChannel (@NonNull String channelId, @NonNull RtmChannelListener channelListener) throws RuntimeException |
abstract RtmCallManager | getRtmCallManager () |
abstract void | queryPeersOnlineStatus (Set< String > peerIds, ResultCallback< Map< String, Boolean >> resultCallback) |
abstract void | subscribePeersOnlineStatus (Set< String > peerIds, ResultCallback< Void > resultCallback) |
abstract void | unsubscribePeersOnlineStatus (Set< String > peerIds, ResultCallback< Void > resultCallback) |
abstract void | queryPeersBySubscriptionOption (Integer option, ResultCallback< Set< String >> resultCallback) |
abstract void | renewToken (String token, ResultCallback< Void > resultCallback) |
abstract void | setLocalUserAttributes (List< RtmAttribute > attributes, ResultCallback< Void > resultCallback) |
abstract void | addOrUpdateLocalUserAttributes (List< RtmAttribute > attributes, ResultCallback< Void > resultCallback) |
abstract void | deleteLocalUserAttributesByKeys (List< String > attributeKeys, ResultCallback< Void > resultCallback) |
abstract void | clearLocalUserAttributes (ResultCallback< Void > resultCallback) |
abstract void | getUserAttributes (String userId, ResultCallback< List< RtmAttribute >> resultCallback) |
abstract void | getUserAttributesByKeys (String userId, List< String > attributeKeys, ResultCallback< List< RtmAttribute >> resultCallback) |
abstract void | setChannelAttributes (String channelId, List< RtmChannelAttribute > attributes, ChannelAttributeOptions option, ResultCallback< Void > resultCallback) |
abstract void | addOrUpdateChannelAttributes (String channelId, List< RtmChannelAttribute > attributes, ChannelAttributeOptions option, ResultCallback< Void > resultCallback) |
abstract void | deleteChannelAttributesByKeys (String channelId, List< String > attributeKeys, ChannelAttributeOptions option, ResultCallback< Void > resultCallback) |
abstract void | clearChannelAttributes (String channelId, ChannelAttributeOptions option, ResultCallback< Void > resultCallback) |
abstract void | getChannelAttributes (String channelId, ResultCallback< List< RtmChannelAttribute >> resultCallback) |
abstract void | getChannelAttributesByKeys (String channelId, List< String > attributeKeys, ResultCallback< List< RtmChannelAttribute >> resultCallback) |
abstract void | getChannelMemberCount (List< String > channelIds, ResultCallback< List< RtmChannelMemberCount >> resultCallback) |
abstract int | setParameters (String parameters) |
abstract int | setLogFile (String filePath) |
abstract int | setLogFilter (int filter) |
abstract int | setLogFileSize (int fileSizeInKBytes) |
Static Public Member Functions | |
static RtmClient | createInstance (@NonNull Context context, @NonNull String appId, @NonNull RtmClientListener eventListener) throws Exception |
static String | getSdkVersion () |
static SET_RTM_SERVICE_CONTEXT_ERR_CODE | setRtmServiceContext (RtmServiceContext context) |
Static Public Attributes | |
static final int | LOG_FILTER_OFF = 0 |
static final int | LOG_FILTER_INFO = 0x0f |
static final int | LOG_FILTER_WARNING = 0x0e |
static final int | LOG_FILTER_ERROR = 0x0c |
static final int | LOG_FILTER_CRITICAL = 0x08 |
static final String | AGORA_RTM_END_CALL_PREFIX = "AgoraRTMLegacyEndcallCompatibleMessagePrefix" |
The entry point of the Agora RTM SDK.
|
static |
Creates an RtmClient instance.
The Agora RTM SDK supports creating multiple RtmClient instances.
All methods in the RtmClient class are executed asynchronously.
context | The context of Android Activity. |
appId | The App ID issued to you from the Agora Console. Apply for a new App ID from Agora if it is missing from your kit. |
eventListener | An RtmClientListener object that reports to the app on RTM SDK runtime events. |
Exception | Returns an exception if appId is invalid (for example, its length is not 32 characters), or context or eventListener is null. |
|
abstract |
Releases all resources used by the RtmClient instance.
Note Do not call this method in any of your callbacks.
|
abstract |
Logs in the Agora RTM system.
Note
token | The token used to log in the Agora RTM system and used when dynamic authentication is enabled. Set token as null in the integration and test stages. |
userId | The user ID of the user logging in the Agora RTM system. The string length must be less than 64 bytes with the following character scope:
userId cannot be empty, null or "null". |
resultCallback | A ResultCallback object.
|
|
abstract |
Logs out of the Agora RTM system.
resultCallback | A ResultCallback object.
|
|
abstract |
Creates an empty text RtmMessage instance.
Note
|
abstract |
Creates a text RtmMessage instance.
Note The RtmMessage instance can be either for a channel message or for a peer-to-peer message.
text | The text content of the message. Must not exceed 32 KB in length. |
|
abstract |
Creates an RtmMessage instance.
Note
data | The raw data content. Must not exceed 32 KB in length. |
|
abstract |
Creates a raw RtmMessage instance.
Note
description
as "" and add a brief text description of the raw message at a later point using the setText method, but please ensure that the size of the text message does not exceed 32 KB. data | The raw data content. Must not exceed 32 KB in length. |
description | The description of data. |
|
abstract |
Creates an RtmFileMessage instance by media ID.
mediaId | Media ID of a file that you uploaded to the Agora server. |
|
abstract |
Creates an RtmImageMessage instance by media ID.
mediaId | Media ID of an image that you uploaded to the Agora server. |
|
abstract |
Uploads a file to the Agora server to get an RtmFileMessage instance.
|
abstract |
Uploads an image to the Agora server to get an RtmImageMessage instance.
|
abstract |
Downloads a file or image from the Agora server to local memory.
|
abstract |
Downloads a file or image from the Agora server to local memory.
mediaId | Media ID of the file or image to download from the Agora server. |
requestId | Unique ID of the download request. |
filePath | Absolute path to download the file or image to. Must be in UTF-8 format. |
resultCallback |
|
abstract |
Cancels an ongoing file or image upload task.
|
abstract |
Cancels an ongoing file or image download task.
|
abstract |
Note
We do not recommend using this method to send a peer-to-peer message. Use sendMessageToPeer instead.
Success:
Failure: The local user receives the onFailure callback with an error. See PeerMessageError for the error codes.
peerId | The user ID of the remote user. |
message | The message to be sent. For information about creating a message, see RtmMessage. |
resultCallback | A ResultCallback object.
|
|
abstract |
Sends an (offline) peer-to-peer message to a specified remote user.
This method allows you to send a message to a specified user when he/she is offline. If you set a message as an offline message and the specified user is offline when you send it, the RTM server caches it. Please note that for now we only cache 200 offline messages for up to seven days for each receiver. When the number of the cached messages reaches this limit, the newest message overrides the oldest one.
If you use this method to send off a text message that starts off with AGORA_RTM_ENDCALL_PREFIX_<channelId>_<your additional information>, then this method is compatible with the endCall method of the legacy Agora Signaling SDK. Replace <channelId> with the channel ID from which you want to leave (end call), and replace <your additional information> with any additional information. Note that you must not put any "_" (underscore) in your additional information but you can set <your additional information> as empty "".
Success:
Failure: The local user receives the onFailure callback with an error. See PeerMessageError for the error codes.
peerId | The user ID of the remote user. The string length must be less than 64 bytes with the following character scope:
userId cannot be empty, null or "null". |
message | The message to be sent. For information about creating a message, see RtmMessage. |
options | Options when sending the message to a peer. See SendMessageOptions. |
resultCallback | A ResultCallback object.
|
|
abstract |
Creates an Agora RTM channel.
Note You can create multiple RtmChannel instances in an RtmClient instance, but you can only join a maximum of 20 channels at the same time. Please call the RtmChannel.release() method to release the resources of some RtmChannel instances that you no longer use. You can of course call the RtmClient.release() method to release all resources used by the RtmClient, but Agora recommends that you NOT rely on the SDK to release an RtmChannel.
channelId | The unique channel name for the Agora RTM session. The string length must be less than 64 bytes with the following character scope:
channelId cannot be empty, null, or "null". |
channelListener | An RtmChannelListener object.
|
RuntimeException | in any of the cases below:
|
|
abstract |
Gets the Agora RTM call manager.
The Agora RTM SDK has one RtmCallManager instance for each RtmClient instance. Different RtmClient instances have different RtmCallManager instances.
|
abstract |
Queries the online status of the specified user(s).
peerIds | A list of the user IDs. |
resultCallback |
|
|
abstract |
Subscribes to the online status of the specified user(s)
Note
peerIds | A list of the specified user IDs. |
resultCallback |
|
|
abstract |
Unsubscribes from the online status of the specified user(s).
peerIds | A list of the specified user IDs. |
resultCallback |
|
|
abstract |
Gets a list of the peers, to whose specific status you have subscribed.
option | The status type, to which you have subscribed. See PeerSubscriptionOption. |
resultCallback |
|
|
abstract |
Renews the RTM Token of the SDK.
You are required to renew your RTM Token when receiving the onTokenExpired callback. The call frequency limit for this method is two calls per second.
token | Your new RTM Token. You need to generate the RTM Token yourself. See Generate an RTM Token. |
resultCallback |
|
|
abstract |
Resets the local user's attributes.
For setLocalUserAttributes, addOrUpdateLocalUserAttributes, deleteLocalUserAttributesByKeys, and clearLocalUserAttributes taken together: the call frequency limit is 10 queries every five seconds.
attributes | The new attributes. See RtmAttribute. |
resultCallback |
|
|
abstract |
Adds or updates the local user's attribute(s).
This method updates the local user's attribute(s) if it finds that the attribute(s) has/have the same key(s), or adds attribute(s) to the local user if it does not.
For setLocalUserAttributes, addOrUpdateLocalUserAttributes, deleteLocalUserAttributesByKeys, and clearLocalUserAttributes taken together: the call frequency limit is 10 queries every five seconds.
attributes | The attributes to be added or updated. See RtmAttribute. |
resultCallback |
|
|
abstract |
Deletes the local user's attributes using attribute keys.
For setLocalUserAttributes, addOrUpdateLocalUserAttributes, deleteLocalUserAttributesByKeys, and clearLocalUserAttributes taken together: the call frequency limit is 10 queries every five seconds.
attributeKeys | A list of the attribute keys to be deleted. |
resultCallback |
|
|
abstract |
Clears all attributes of the local user.
For setLocalUserAttributes, addOrUpdateLocalUserAttributes, deleteLocalUserAttributesByKeys, and clearLocalUserAttributes taken together: the call frequency limit is 10 queries every five seconds.
resultCallback |
|
|
abstract |
Gets all attributes of a specified user.
For getUserAttributes and getUserAttributesByKeys taken together, the call frequency limit is 40 queries every five seconds.
userId | The user ID of the specified user. |
resultCallback |
|
|
abstract |
Gets the attributes of a specified user using attribute keys.
For getUserAttributes and getUserAttributesByKeys taken together, the call frequency limit is 40 queries every five seconds.
userId | The user ID of the specified user. |
attributeKeys | An array of the attribute keys. |
resultCallback |
|
|
abstract |
Resets the attributes of a specified channel.
Note
channelId | The ID of the specified channel. |
attributes | An array of channel attributes. See RtmChannelAttribute. |
option | Options for this attribute operation. See ChannelAttributeOptions. |
resultCallback |
|
|
abstract |
Adds or updates the attribute(s) of a specified channel.
This method updates the specified channel's attribute(s) if it finds that the attribute(s) has/have the same key(s), or adds attribute(s) to the channel if it does not.
Note
channelId | The ID of the specified channel. |
attributes | An array of channel attributes. See RtmChannelAttribute. |
option | Options for this attribute operation. See ChannelAttributeOptions. |
resultCallback |
|
|
abstract |
Deletes the attributes of a specified channel by attribute keys.
Note
channelId | The ID of the specified channel. |
attributeKeys | A list of channel attribute keys. |
option | Options for this attribute operation. See ChannelAttributeOptions. |
resultCallback |
|
|
abstract |
Clears all attributes of a specified channel.
Note
channelId | The ID of the specified channel. |
option | Options for this attribute operation. See ChannelAttributeOptions. |
resultCallback |
|
|
abstract |
Gets all attributes of a specified channel.
Note
channelId | The ID of the specified channel. |
resultCallback |
|
|
abstract |
Gets the attributes of a specified channel by attribute keys.
Note
channelId | The ID of the specified channel. |
attributeKeys | An array of attribute keys. |
resultCallback |
|
|
abstract |
Gets the member count of specified channel(s).
Note
channelIds | An array of the specified channel ID(s). |
resultCallback |
|
|
abstract |
Provides technical preview functionalities or special customizations by configuring the SDK with JSON options.
The JSON options are not public by default. Agora is working on making commonly used JSON options public in a standard way.
parameters | SDK options in the JSON format. |
|
abstract |
Specifies the default path to the SDK log file.
filePath | File path of the log file. The string of filePath is in UTF-8. The default log file path in the Android operating system is /sdcard/{Package name of the App}/agorartm.log. |
Note
|
abstract |
Sets the output log level of the SDK.
You can use one or a combination of the filters. The log level follows the sequence of OFF, CRITICAL, ERROR, WARNING, and INFO. Choose a level to see the logs preceding that level. If, for example, you set the log level to WARNING, you see the logs within levels CRITICAL, ERROR, and WARNING.
filter | Sets the log filter level:
|
|
abstract |
Sets the size of a single log file. The SDK has two log files with the same size.
fileSizeInKBytes | The size of a single log file (KB). The default is 10240 (KB). The value range is [512 KB, 1 GB]. |
|
static |
Gets the SDK version.
|
static |
Sets the context of all RtmClient
instances. All RtmClient
instances you create after calling this method match the context.
RtmClient
instance. Otherwise, this method returns the SET_RTM_SERVICE_CONTEXT_ERR_FAILURE
error code.context | Context of the RtmClient instance, including geofencing. See RtmServiceContext. |
|
static |
0: Do not output any log information.
|
static |
0x0f: Output CRITICAL, ERROR, WARNING, and INFO level log information.
|
static |
0x0e: Output CRITICAL, ERROR, and WARNING level log information.
|
static |
0x0c: Output CRITICAL and ERROR level log information.
|
static |
0x08: Output CRITICAL level log information.
|
static |
The prefix for ending a call. You can use it with the sendMessageToPeer method to be compatible with the endCall method of the legacy Agora Signaling SDK.