Signaling (previously RTM) SDK v1.5.0 API Reference for Android
Public Member Functions | List of all members
io.agora.rtm.RtmClientListener Interface Reference

Public Member Functions

void  onConnectionStateChanged (int state, int reason)
 
void  onMessageReceived (RtmMessage message, String peerId)
 
void  onImageMessageReceivedFromPeer (RtmImageMessage message, String peerId)
 
void  onFileMessageReceivedFromPeer (RtmFileMessage message, String peerId)
 
void  onMediaUploadingProgress (RtmMediaOperationProgress progress, long requestId)
 
void  onMediaDownloadingProgress (RtmMediaOperationProgress progress, long requestId)
 
void  onTokenExpired ()
 
void  onTokenPrivilegeWillExpire ()
 
void  onPeersOnlineStatusChanged (Map< String, Integer > peersStatus)
 

Detailed Description

Callbacks for the Agora RTM client methods.

Member Function Documentation

◆ onConnectionStateChanged()

void io.agora.rtm.RtmClientListener.onConnectionStateChanged ( int  state,
int  reason 
)

Occurs when the connection state between the SDK and the Agora RTM system changes.

Parameters
state The new connection state. See ConnectionState.
reason The reason for the connection state change. See ConnectionChangeReason.

◆ onMessageReceived()

void io.agora.rtm.RtmClientListener.onMessageReceived ( RtmMessage  message,
String  peerId 
)

Occurs when the local user receives a peer-to-peer message.

Parameters
message The received message. See RtmMessage.
peerId The user ID of the message sender.

◆ onImageMessageReceivedFromPeer()

void io.agora.rtm.RtmClientListener.onImageMessageReceivedFromPeer ( RtmImageMessage  message,
String  peerId 
)
Deprecated:
Deprecated as of v1.5.0. Agora recommends that you do not use it.

Occurs when the local user receives a peer-to-peer image message.

Parameters
message The received image message. See RtmImageMessage.
peerId The user ID of the message sender.

◆ onFileMessageReceivedFromPeer()

void io.agora.rtm.RtmClientListener.onFileMessageReceivedFromPeer ( RtmFileMessage  message,
String  peerId 
)
Deprecated:
Deprecated as of v1.5.0. Agora recommends that you do not use it.

Occurs when the local user receives a peer-to-peer file message.

Parameters
message The received file message. See RtmFileMessage.
peerId The user ID of the message sender.

◆ onMediaUploadingProgress()

void io.agora.rtm.RtmClientListener.onMediaUploadingProgress ( RtmMediaOperationProgress  progress,
long  requestId 
)
Deprecated:
Deprecated as of v1.5.0. Agora recommends that you do not use it.

Active callback: Reports the upload progress.

Parameters
progress Upload progress of a file or image. See RtmMediaOperationProgress.
requestId Unique ID for the upload request.

◆ onMediaDownloadingProgress()

void io.agora.rtm.RtmClientListener.onMediaDownloadingProgress ( RtmMediaOperationProgress  progress,
long  requestId 
)
Deprecated:
Deprecated as of v1.5.0. Agora recommends that you do not use it.

Active callback: Reports the download progress.

Parameters
progress Download progress of a file or image. See RtmMediaOperationProgress.
requestId Unique ID for the download request.

◆ onTokenExpired()

void io.agora.rtm.RtmClientListener.onTokenExpired ( )

Occurs when the RTM server detects that the RTM token has exceeded the specified validity period.

  • If the SDK is in the CONNECTION_STATE_CONNECTED state, the connection state switches to CONNECTION_STATE_ABORTED and you need to call the login method to log in again.
  • If the SDK is in the CONNECTION_STATE_RECONNECTING state, you will receive this callback when the network reconnects and you need to call the renewToken method to pass the new Token on to the server.

◆ onTokenPrivilegeWillExpire()

void io.agora.rtm.RtmClientListener.onTokenPrivilegeWillExpire ( )

Occurs when the token expires in 30 seconds.

  • Upon receiving this callback, generate a new token on the server and call the renewToken method to pass the new token to the SDK.
  • If the token used in a login session expires, the user becomes offline and the SDK attempts to reconnect.

◆ onPeersOnlineStatusChanged()

void io.agora.rtm.RtmClientListener.onPeersOnlineStatusChanged ( Map< String, Integer >  peersStatus )

Occurs when the online status of the peers, to whom you subscribe, changes.

  • When the subscription to the online status of specified peer(s) succeeds, the SDK returns this 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 this 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 this callback to report whose online status has changed when successfully reconnecting to the server.
Parameters
peersStatus An array of peers' online states. See PeerOnlineState.