Agora Java API Reference for Android
|
Classes | |
class | RtmConnectionState |
Public Member Functions | |
void | onMessageEvent (MessageEvent event) |
void | onPresenceEvent (PresenceEvent event) |
void | onJoinResult (String channelName, String userId, int errorCode) |
void | onLeaveResult (String channelName, String userId, int errorCode) |
void | onJoinTopicResult (String channelName, String userId, String topicName, String meta, int errorCode) |
void | onLeaveTopicResult (String channelName, String userId, String topicName, String meta, int errorCode) |
void | onTopicSubscribed (String channelName, String userId, String topicName, UserList successUsers, UserList failedUsers, int errorCode) |
void | onTopicUnsubscribed (String channelName, String userId, String topicName, UserList successUsers, UserList failedUsers, int errorCode) |
void | onConnectionStateChange (String channelName, int state, int reason) |
The IRtmEventHandler 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.
void io.agora.rtm2.IRtmEventHandler.onMessageEvent | ( | MessageEvent | event | ) |
Occurs when receive a message.
event | details of message event. |
void io.agora.rtm2.IRtmEventHandler.onPresenceEvent | ( | PresenceEvent | event | ) |
Occurs when remote user join/leave channel, join/leave topic or local user joined channel.
note: When remote user join/leave channel will trigger this callback. When remote user(in same channel) joinTopic/destroy Topic will trigger this callback. When local user join channel will trigger this callback.
For type(RTM_PRESENCE_TYPE_REMOTE_JOIN_CHANNEL/RTM_PRESENCE_TYPE_REMOTE_LEAVE_CHANNEL), valid field will be channelType/type/channelName/userId For type(RTM_PRESENCE_TYPE_REMOTE_JOIN_TOPIC/RTM_PRESENCE_TYPE_REMOTE_LEAVE_TOPIC) valid field will be channelType/type/channelName/topicInfos/topicInfoNumber For type(RTM_PRESENCE_TYPE_SELF_JOIN_CHANNEL) valid field will be channelType/type/channelName/topicInfos/topicInfoNumber/userId
event | details of presence event. |
void io.agora.rtm2.IRtmEventHandler.onJoinResult | ( | String | channelName, |
String | userId, | ||
int | errorCode | ||
) |
Occurs when user join a channel.
channelName | The Name of the channel. |
userId | The id of the user. |
errorCode | The error code. |
void io.agora.rtm2.IRtmEventHandler.onLeaveResult | ( | String | channelName, |
String | userId, | ||
int | errorCode | ||
) |
Occurs when user leave a channel.
channelName | The Name of the channel. |
userId | The id of the user. |
errorCode | The error code. |
void io.agora.rtm2.IRtmEventHandler.onJoinTopicResult | ( | String | channelName, |
String | userId, | ||
String | topicName, | ||
String | meta, | ||
int | errorCode | ||
) |
Occurs when user join topic.
channelName | The Name of the channel. |
userId | The id of the user. |
topicName | The name of the topic. |
meta | The meta of the topic. |
errorCode | The error code. |
void io.agora.rtm2.IRtmEventHandler.onLeaveTopicResult | ( | String | channelName, |
String | userId, | ||
String | topicName, | ||
String | meta, | ||
int | errorCode | ||
) |
Occurs when user leave topic.
channelName | The Name of the channel. |
userId | The id of the user. |
topicName | The name of the topic. |
meta | The meta of the topic. |
errorCode | The error code. |
void io.agora.rtm2.IRtmEventHandler.onTopicSubscribed | ( | String | channelName, |
String | userId, | ||
String | topicName, | ||
UserList | successUsers, | ||
UserList | failedUsers, | ||
int | errorCode | ||
) |
Occurs when user subscribed topic.
channelName | The Name of the channel. |
userId | The id of the user. |
topicName | The name of the topic. |
succeedUsers | The subscribed users. |
failedUser | The failed to subscribe users. |
errorCode | The error code. |
void io.agora.rtm2.IRtmEventHandler.onTopicUnsubscribed | ( | String | channelName, |
String | userId, | ||
String | topicName, | ||
UserList | successUsers, | ||
UserList | failedUsers, | ||
int | errorCode | ||
) |
Occurs when user unsubscribed topic.
channelName | The Name of the channel. |
userId | The id of the user. |
topicName | The name of the topic. |
succeedUsers | The unsubscribed users. |
failedUser | The failed to unsubscribe users. |
errorCode | The error code. |
void io.agora.rtm2.IRtmEventHandler.onConnectionStateChange | ( | String | channelName, |
int | state, | ||
int | reason | ||
) |
Occurs when the connection state changes between rtm sdk and agora server.
channelName | The Name of the channel. |
state | The new connection state. |
reason | The reason for the connection state change. |