Signaling (previously RTM) SDK v1.5.0 API Reference for Android
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
io.agora.rtm.RtmClient Class Referenceabstract

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"
 

Detailed Description

The entry point of the Agora RTM SDK.

Member Function Documentation

◆ createInstance()

static RtmClient io.agora.rtm.RtmClient.createInstance ( @NonNull Context  context,
@NonNull String  appId,
@NonNull RtmClientListener  eventListener 
) throws Exception
static

Creates an RtmClient instance.

The Agora RTM SDK supports creating multiple RtmClient instances.

All methods in the RtmClient class are executed asynchronously.

Parameters
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.
Returns
An RtmClient object.
Exceptions
Exception Returns an exception if appId is invalid (for example, its length is not 32 characters), or context or eventListener is null.

◆ release()

abstract void io.agora.rtm.RtmClient.release ( )
abstract

Releases all resources used by the RtmClient instance.

Note Do not call this method in any of your callbacks.

◆ login()

abstract void io.agora.rtm.RtmClient.login ( @Nullable String  token,
@NonNull String  userId,
@Nullable ResultCallback< Void >  resultCallback 
)
abstract

Logs in the Agora RTM system.

Note

Parameters
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:
  • All lowercase English letters: a to z
  • All uppercase English letters: A to Z
  • All numeric characters: 0 to 9
  • The space character.
  • Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ","
Note A userId cannot be empty, null or "null".
resultCallback A ResultCallback object.
  • Success: The local user receives the onSuccess callback.
  • Failure: The local user receives the onFailure callback. See LoginError for the error codes.

◆ logout()

abstract void io.agora.rtm.RtmClient.logout ( @Nullable ResultCallback< Void >  resultCallback )
abstract

Logs out of the Agora RTM system.

Parameters
resultCallback A ResultCallback object.
  • Success: The local user receives the onSuccess callback.
  • Failure: The local user receives the onFailure callback. See LogoutError for the error codes.

◆ createMessage() [1/4]

abstract RtmMessage io.agora.rtm.RtmClient.createMessage ( )
abstract

Creates an empty text RtmMessage instance.

Note

  • The RtmMessage instance can be either for a channel message or for a peer-to-peer message.
  • You can set the content of the text message at a later point using the setText method, but please ensure that the size of the text message does not exceed 32 KB.
Returns
An empty text RtmMessage instance.

◆ createMessage() [2/4]

abstract RtmMessage io.agora.rtm.RtmClient.createMessage ( String  text )
abstract

Creates a text RtmMessage instance.

Note The RtmMessage instance can be either for a channel message or for a peer-to-peer message.

Parameters
text The text content of the message. Must not exceed 32 KB in length.
Returns
A text RtmMessage instance.

◆ createMessage() [3/4]

abstract RtmMessage io.agora.rtm.RtmClient.createMessage ( byte[]  data )
abstract

Creates an RtmMessage instance.

Note

  • The RtmMessage instance can be either for a channel message or for a peer-to-peer message.
  • You can set 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.
Parameters
data The raw data content. Must not exceed 32 KB in length.
Returns
A raw RtmMessage instance.

◆ createMessage() [4/4]

abstract RtmMessage io.agora.rtm.RtmClient.createMessage ( byte[]  data,
String  description 
)
abstract

Creates a raw RtmMessage instance.

Note

  • The RtmMessage instance can be either for a channel message or for a peer-to-peer message.
  • You can set 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.
Parameters
data The raw data content. Must not exceed 32 KB in length.
description The description of data.
Returns
A raw RtmMessage instance with a brief text description.

◆ createFileMessageByMediaId()

abstract RtmFileMessage io.agora.rtm.RtmClient.createFileMessageByMediaId ( @NonNull String  mediaId )
abstract
Deprecated:
Deprecated as of v1.5.0. Agora recommends that you do not use it.

Creates an RtmFileMessage instance by media ID.

  • If you have a media ID that corresponds to a file in the Agora server, you can use this method to create an RtmFileMessage instance.
  • If you do not have a media ID, you need to call the createFileMessageByUploading method to upload a file to the Agora server to get a RtmFileMessage instance.
Parameters
mediaId Media ID of a file that you uploaded to the Agora server.
Returns
An RtmFileMessage instance.

◆ createImageMessageByMediaId()

abstract RtmImageMessage io.agora.rtm.RtmClient.createImageMessageByMediaId ( @NonNull String  mediaId )
abstract
Deprecated:
Deprecated as of v1.5.0. Agora recommends that you do not use it.

Creates an RtmImageMessage instance by media ID.

  • If you have a media ID that corresponds to an image in the Agora server, you can use this method to create an RtmImageMessage instance.
  • If you do not have a media ID, you need to call the createImageMessageByUploading method to upload an image to the Agora server to get a RtmImageMessage instance.
Parameters
mediaId Media ID of an image that you uploaded to the Agora server.
Returns
An RtmImageMessage instance.

◆ createFileMessageByUploading()

abstract void io.agora.rtm.RtmClient.createFileMessageByUploading ( @NonNull String  filePath,
RtmRequestId  requestId,
ResultCallback< RtmFileMessage resultCallback 
)
abstract
Deprecated:
Deprecated as of v1.5.0. Agora recommends that you do not use it.

Uploads a file to the Agora server to get an RtmFileMessage instance.

Note
If you already have a media ID that corresponds to the file in the Agora server, you can call the createFileMessageByMediaId method to create an RtmFileMessage instance.
Parameters
filePath Absolute path of the file to upload. Must be in UTF-8 format.
requestId Unique ID of the upload request.
resultCallback
  • Success: The local user receives the onSuccess callback.
  • Failure: The local user receives the onFailure callback.

◆ createImageMessageByUploading()

abstract void io.agora.rtm.RtmClient.createImageMessageByUploading ( @NonNull String  filePath,
RtmRequestId  requestId,
ResultCallback< RtmImageMessage resultCallback 
)
abstract
Deprecated:
Deprecated as of v1.5.0. Agora recommends that you do not use it.

Uploads an image to the Agora server to get an RtmImageMessage instance.

Note
If you already have a media ID that corresponds to the image in the Agora server, you can call the createImageMessageByMediaId method to create an RtmImageMessage instance.
Parameters
filePath Absolute path of the image to upload. Must be in UTF-8 format.
requestId Unique ID of the upload request.
resultCallback
  • Success: The local user receives the onSuccess callback.
  • Failure: The local user receives the onFailure callback.

◆ downloadMediaToMemory()

abstract void io.agora.rtm.RtmClient.downloadMediaToMemory ( @NonNull String  mediaId,
RtmRequestId  requestId,
ResultCallback< byte[]>  resultCallback 
)
abstract
Deprecated:
Deprecated as of v1.5.0. Agora recommends that you do not use it.

Downloads a file or image from the Agora server to local memory.

Note
  • Use this method if you need to read a file or image immediately after you download it.
  • The SDK releases the downloaded file or image as soon as the callback ends.
Parameters
mediaId Media ID of the file or image to download from the Agora server.
requestId Unique ID of the download request.
resultCallback
  • Success: The local user receives the onSuccess callback.
  • Failure: The local user receives the onFailure callback.

◆ downloadMediaToFile()

abstract void io.agora.rtm.RtmClient.downloadMediaToFile ( @NonNull String  mediaId,
@NonNull String  filePath,
RtmRequestId  requestId,
ResultCallback< Void >  resultCallback 
)
abstract
Deprecated:
Deprecated as of v1.5.0. Agora recommends that you do not use it.

Downloads a file or image from the Agora server to local memory.

Parameters
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
  • Success: The local user receives the onSuccess callback.
  • Failure: The local user receives the onFailure callback.

◆ cancelMediaUpload()

abstract void io.agora.rtm.RtmClient.cancelMediaUpload ( RtmRequestId  requestId,
ResultCallback< Void >  resultCallback 
)
abstract
Deprecated:
Deprecated as of v1.5.0. Agora recommends that you do not use it.

Cancels an ongoing file or image upload task.

Note
You can only cancel an ongoing upload task. After an upload task completes, you cannot cancel the task because the request ID is no longer valid.
Parameters
requestId Unique ID of the upload request.
resultCallback
  • Success: The local user receives the onSuccess callback.
  • Failure: The local user receives the onFailure callback.

◆ cancelMediaDownload()

abstract void io.agora.rtm.RtmClient.cancelMediaDownload ( RtmRequestId  requestId,
ResultCallback< Void >  resultCallback 
)
abstract
Deprecated:
Deprecated as of v1.5.0. Agora recommends that you do not use it.

Cancels an ongoing file or image download task.

Note
You can only cancel an ongoing download task. After a download task completes, you cannot cancel the task because the request ID is no longer valid.
Parameters
requestId Unique ID of the download request.
resultCallback
  • Success: The local user receives the onSuccess callback.
  • Failure: The local user receives the onFailure callback.

◆ sendMessageToPeer() [1/2]

abstract void io.agora.rtm.RtmClient.sendMessageToPeer ( @NonNull String  peerId,
@NonNull RtmMessage  message,
@Nullable ResultCallback< Void >  resultCallback 
)
abstract
Deprecated:
Sends a peer-to-peer message to a specified remote user.

Note

We do not recommend using this method to send a peer-to-peer message. Use sendMessageToPeer instead.

You can send messages, including peer-to-peer and channel messages, at a maximum frequency of 180 calls every three seconds.

Success:

Failure: The local user receives the onFailure callback with an error. See PeerMessageError for the error codes.

Parameters
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.

◆ sendMessageToPeer() [2/2]

abstract void io.agora.rtm.RtmClient.sendMessageToPeer ( @NonNull String  peerId,
@NonNull RtmMessage  message,
@NonNull SendMessageOptions  options,
@Nullable ResultCallback< Void >  resultCallback 
)
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 "".

You can send messages, including peer-to-peer and channel messages, at a maximum frequency of 180 calls every three seconds.

Success:

Failure: The local user receives the onFailure callback with an error. See PeerMessageError for the error codes.

Parameters
peerId The user ID of the remote user. The string length must be less than 64 bytes with the following character scope:
  • All lowercase English letters: a to z
  • All uppercase English letters: A to Z
  • All numeric characters: 0 to 9
  • The space character.
  • Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ","
Note A 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.

◆ createChannel()

abstract RtmChannel io.agora.rtm.RtmClient.createChannel ( @NonNull String  channelId,
@NonNull RtmChannelListener  channelListener 
) throws RuntimeException
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.

Parameters
channelId The unique channel name for the Agora RTM session. The string length must be less than 64 bytes with the following character scope:
  • All lowercase English letters: a to z
  • All uppercase English letters: A to Z
  • All numeric characters: 0 to 9
  • The space character.
  • Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ","
Note A channelId cannot be empty, null, or "null".
channelListener An RtmChannelListener object.
  • Success: The SDK returns an RtmChannel instance. If a channel with the same channelId does not exist, the method returns the created channel instance. If a channel with the same channelId already exists, the method returns the existing channel instance.
  • Failure: The SDK returns null. Possible reasons: The channelId is invalid or you have joined the maximum number of channels.
Exceptions
RuntimeException in any of the cases below:
  • The channelId is invalid.
  • The channelId is already in use.
  • The RtmClient instance is released.

◆ getRtmCallManager()

abstract RtmCallManager io.agora.rtm.RtmClient.getRtmCallManager ( )
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.

Returns

◆ queryPeersOnlineStatus()

abstract void io.agora.rtm.RtmClient.queryPeersOnlineStatus ( Set< String >  peerIds,
ResultCallback< Map< String, Boolean > >  resultCallback 
)
abstract

Queries the online status of the specified user(s).

  • Online: The user has logged in the Agora RTM system.
  • Offline: The user has logged out of the Agora RTM system.
Parameters
peerIds A list of the user IDs.
resultCallback

◆ subscribePeersOnlineStatus()

abstract void io.agora.rtm.RtmClient.subscribePeersOnlineStatus ( Set< String >  peerIds,
ResultCallback< Void >  resultCallback 
)
abstract

Subscribes to the online status of the specified user(s)

  • When the method call succeeds, the SDK returns the onPeersOnlineStatusChanged callback to report the online status of peers, to whom you subscribe.
  • When the online status of the peers, to whom you subscribe, changes, the SDK returns the onPeersOnlineStatusChanged callback to report whose online status has changed.
  • If the online status of the peers, to whom you subscribe, changes when the SDK is reconnecting to the server, the SDK returns the onPeersOnlineStatusChanged callback to report whose online status has changed when successfully reconnecting to the server.

Note

  • When you log out of the Agora RTM system, all the status that you subscribe to will be cleared. To keep the original subscription after you re-log in the system, you need to redo the whole subscription process.
  • When the SDK reconnects to the server from the state of being interrupted, the SDK automatically subscribes to the peers and states before the interruption without human intervention.
Parameters
peerIds A list of the specified user IDs.
resultCallback

◆ unsubscribePeersOnlineStatus()

abstract void io.agora.rtm.RtmClient.unsubscribePeersOnlineStatus ( Set< String >  peerIds,
ResultCallback< Void >  resultCallback 
)
abstract

Unsubscribes from the online status of the specified user(s).

Parameters
peerIds A list of the specified user IDs.
resultCallback

◆ queryPeersBySubscriptionOption()

abstract void io.agora.rtm.RtmClient.queryPeersBySubscriptionOption ( Integer  option,
ResultCallback< Set< String > >  resultCallback 
)
abstract

Gets a list of the peers, to whose specific status you have subscribed.

Parameters
option The status type, to which you have subscribed. See PeerSubscriptionOption.
resultCallback

◆ renewToken()

abstract void io.agora.rtm.RtmClient.renewToken ( String  token,
ResultCallback< Void >  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.

Parameters
token Your new RTM Token. You need to generate the RTM Token yourself. See Generate an RTM Token.
resultCallback

◆ setLocalUserAttributes()

abstract void io.agora.rtm.RtmClient.setLocalUserAttributes ( List< RtmAttribute attributes,
ResultCallback< Void >  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.

Parameters
attributes The new attributes. See RtmAttribute.
resultCallback

◆ addOrUpdateLocalUserAttributes()

abstract void io.agora.rtm.RtmClient.addOrUpdateLocalUserAttributes ( List< RtmAttribute attributes,
ResultCallback< Void >  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.

Parameters
attributes The attributes to be added or updated. See RtmAttribute.
resultCallback

◆ deleteLocalUserAttributesByKeys()

abstract void io.agora.rtm.RtmClient.deleteLocalUserAttributesByKeys ( List< String >  attributeKeys,
ResultCallback< Void >  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.

Parameters
attributeKeys A list of the attribute keys to be deleted.
resultCallback

◆ clearLocalUserAttributes()

abstract void io.agora.rtm.RtmClient.clearLocalUserAttributes ( ResultCallback< Void >  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.

Parameters
resultCallback

◆ getUserAttributes()

abstract void io.agora.rtm.RtmClient.getUserAttributes ( String  userId,
ResultCallback< List< RtmAttribute > >  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.

Parameters
userId The user ID of the specified user.
resultCallback

◆ getUserAttributesByKeys()

abstract void io.agora.rtm.RtmClient.getUserAttributesByKeys ( String  userId,
List< String >  attributeKeys,
ResultCallback< List< RtmAttribute > >  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.

Parameters
userId The user ID of the specified user.
attributeKeys An array of the attribute keys.
resultCallback

◆ setChannelAttributes()

abstract void io.agora.rtm.RtmClient.setChannelAttributes ( String  channelId,
List< RtmChannelAttribute attributes,
ChannelAttributeOptions  option,
ResultCallback< Void >  resultCallback 
)
abstract

Resets the attributes of a specified channel.

Note

Parameters
channelId The ID of the specified channel.
attributes An array of channel attributes. See RtmChannelAttribute.
option Options for this attribute operation. See ChannelAttributeOptions.
resultCallback

◆ addOrUpdateChannelAttributes()

abstract void io.agora.rtm.RtmClient.addOrUpdateChannelAttributes ( String  channelId,
List< RtmChannelAttribute attributes,
ChannelAttributeOptions  option,
ResultCallback< Void >  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

Parameters
channelId The ID of the specified channel.
attributes An array of channel attributes. See RtmChannelAttribute.
option Options for this attribute operation. See ChannelAttributeOptions.
resultCallback

◆ deleteChannelAttributesByKeys()

abstract void io.agora.rtm.RtmClient.deleteChannelAttributesByKeys ( String  channelId,
List< String >  attributeKeys,
ChannelAttributeOptions  option,
ResultCallback< Void >  resultCallback 
)
abstract

Deletes the attributes of a specified channel by attribute keys.

Note

Parameters
channelId The ID of the specified channel.
attributeKeys A list of channel attribute keys.
option Options for this attribute operation. See ChannelAttributeOptions.
resultCallback

◆ clearChannelAttributes()

abstract void io.agora.rtm.RtmClient.clearChannelAttributes ( String  channelId,
ChannelAttributeOptions  option,
ResultCallback< Void >  resultCallback 
)
abstract

Clears all attributes of a specified channel.

Note

Parameters
channelId The ID of the specified channel.
option Options for this attribute operation. See ChannelAttributeOptions.
resultCallback

◆ getChannelAttributes()

abstract void io.agora.rtm.RtmClient.getChannelAttributes ( String  channelId,
ResultCallback< List< RtmChannelAttribute > >  resultCallback 
)
abstract

Gets all attributes of a specified channel.

Note

Parameters
channelId The ID of the specified channel.
resultCallback

◆ getChannelAttributesByKeys()

abstract void io.agora.rtm.RtmClient.getChannelAttributesByKeys ( String  channelId,
List< String >  attributeKeys,
ResultCallback< List< RtmChannelAttribute > >  resultCallback 
)
abstract

Gets the attributes of a specified channel by attribute keys.

Note

Parameters
channelId The ID of the specified channel.
attributeKeys An array of attribute keys.
resultCallback

◆ getChannelMemberCount()

abstract void io.agora.rtm.RtmClient.getChannelMemberCount ( List< String >  channelIds,
ResultCallback< List< RtmChannelMemberCount > >  resultCallback 
)
abstract

Gets the member count of specified channel(s).

Note

  • The call frequency limit for this method is one query per second.
  • We do not support getting the member counts of more than 32 channels in one method call.
  • You do not have to join the specified channel(s) to call this method.
Parameters
channelIds An array of the specified channel ID(s).
resultCallback

◆ setParameters()

abstract int io.agora.rtm.RtmClient.setParameters ( String  parameters )
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
parameters SDK options in the JSON format.
Returns
  • 0: Success.
  • ≠0: Failure.

◆ setLogFile()

abstract int io.agora.rtm.RtmClient.setLogFile ( String  filePath )
abstract

Specifies the default path to the SDK log file.

Parameters
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

  • Ensure that the directory holding the log file exists and is writable.
  • Ensure that you call this method immediately after calling the createInstance method, otherwise the output log may be incomplete.
Returns
  • 0: Success.
  • ≠0: Failure.

◆ setLogFilter()

abstract int io.agora.rtm.RtmClient.setLogFilter ( int  filter )
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.

Parameters
filter Sets the log filter level:
Returns
  • 0: Success.
  • ≠0: Failure.

◆ setLogFileSize()

abstract int io.agora.rtm.RtmClient.setLogFileSize ( int  fileSizeInKBytes )
abstract

Sets the size of a single log file. The SDK has two log files with the same size.

Parameters
fileSizeInKBytes The size of a single log file (KB). The default is 10240 (KB). The value range is [512 KB, 1 GB].
Returns
  • 0: Success.
  • ≠0: Failure.

◆ getSdkVersion()

static String io.agora.rtm.RtmClient.getSdkVersion ( )
static

Gets the SDK version.

Returns
The current version of the Agora RTM SDK in the string format. For example, 1.0.0.

◆ setRtmServiceContext()

static SET_RTM_SERVICE_CONTEXT_ERR_CODE io.agora.rtm.RtmClient.setRtmServiceContext ( RtmServiceContext  context )
static

Sets the context of all RtmClient instances. All RtmClient instances you create after calling this method match the context.

Note
You must call this method before calling createInstance to create an RtmClient instance or after calling release to release any existing RtmClient instance. Otherwise, this method returns the SET_RTM_SERVICE_CONTEXT_ERR_FAILURE error code.
Parameters
context Context of the RtmClient instance, including geofencing. See RtmServiceContext.
Returns
SetRtmServiceContextError.

Member Data Documentation

◆ LOG_FILTER_OFF

final int io.agora.rtm.RtmClient.LOG_FILTER_OFF = 0
static

0: Do not output any log information.

◆ LOG_FILTER_INFO

final int io.agora.rtm.RtmClient.LOG_FILTER_INFO = 0x0f
static

0x0f: Output CRITICAL, ERROR, WARNING, and INFO level log information.

◆ LOG_FILTER_WARNING

final int io.agora.rtm.RtmClient.LOG_FILTER_WARNING = 0x0e
static

0x0e: Output CRITICAL, ERROR, and WARNING level log information.

◆ LOG_FILTER_ERROR

final int io.agora.rtm.RtmClient.LOG_FILTER_ERROR = 0x0c
static

0x0c: Output CRITICAL and ERROR level log information.

◆ LOG_FILTER_CRITICAL

final int io.agora.rtm.RtmClient.LOG_FILTER_CRITICAL = 0x08
static

0x08: Output CRITICAL level log information.

◆ AGORA_RTM_END_CALL_PREFIX

final String io.agora.rtm.RtmClient.AGORA_RTM_END_CALL_PREFIX = "AgoraRTMLegacyEndcallCompatibleMessagePrefix"
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.