Agora Java API Reference for Android

Public Member Functions | List of all members
io.agora.rtm.RtmEventListener Interface Reference

## Public Member Functions
default void | onLinkStateEvent (LinkStateEvent event)
default void | onMessageEvent (MessageEvent event)
default void | onPresenceEvent (PresenceEvent event)
default void | onTopicEvent (TopicEvent event)
default void | onLockEvent (LockEvent event)
default void | onStorageEvent (StorageEvent event)
default void | onTokenEvent (TokenEvent event)
default void | onConnectionStateChanged (String channelName, RtmConnectionState state, RtmConnectionChangeReason reason)
default void | onTokenPrivilegeWillExpire (String channelName)

## Detailed Description

The RtmEventListener class.

The SDK uses this class to send callback event notifications to the app, and the app inherits the methods in this class to retrieve these event notifications.

All methods in this class have their default (empty) implementations, and the app can inherit only some of the required events instead of all. In the callback methods, the app should avoid time-consuming tasks or calling blocking APIs, otherwise the SDK may not work properly.

## Member Function Documentation

## ◆ onLinkStateEvent()

default void io.agora.rtm.RtmEventListener.onLinkStateEvent | ( | LinkStateEvent | event | ) |

Occurs when link state change

Parameters

  event | details of link state event

## ◆ onMessageEvent()

default void io.agora.rtm.RtmEventListener.onMessageEvent | ( | MessageEvent | event | ) |

Occurs when receive a message.

Parameters

  event | details of message event.

## ◆ onPresenceEvent()

default void io.agora.rtm.RtmEventListener.onPresenceEvent | ( | PresenceEvent | event | ) |

Occurs when remote user presence changed

Parameters

  event | details of presence event.

## ◆ onTopicEvent()

default void io.agora.rtm.RtmEventListener.onTopicEvent | ( | TopicEvent | event | ) |

Occurs when remote user join/leave topic or when user first join this channel, got snapshot of topics in this channel

Parameters

  event | details of topic event.

## ◆ onLockEvent()

default void io.agora.rtm.RtmEventListener.onLockEvent | ( | LockEvent | event | ) |

Occurs when lock state changed

Parameters

  event | details of lock event.

## ◆ onStorageEvent()

default void io.agora.rtm.RtmEventListener.onStorageEvent | ( | StorageEvent | event | ) |

Occurs when receive storage event

Parameters

  event | details of storage event.

## ◆ onTokenEvent()

default void io.agora.rtm.RtmEventListener.onTokenEvent | ( | TokenEvent | event | ) |

Occurs when receive token event

Parameters

  event | details of token event.

## ◆ onConnectionStateChanged()

default void io.agora.rtm.RtmEventListener.onConnectionStateChanged | ( | String | channelName,
|  | RtmConnectionState | state,
|  | RtmConnectionChangeReason | reason
| ) |  |

Occurs when the connection state changes between rtm sdk and agora server.

Deprecated:
  This callback is deprecated. Use LinkStateEvent instead.

Parameters

  channelName | The Name of the channel.
  state | The new connection state.
  reason | The reason for the connection state change.

## ◆ onTokenPrivilegeWillExpire()

default void io.agora.rtm.RtmEventListener.onTokenPrivilegeWillExpire | ( | String | channelName | ) |

Occurs when token will expire in 30 seconds.

Parameters

  channelName | The name of the channel.