Chat SDK for Android v1.2.1
agora java chat SDK
|
Public Member Functions | |
void | onConnected () |
void | onDisconnected (final int errorCode) |
default void | onTokenExpired () |
default void | onTokenWillExpire () |
default void | onLogout (final int errorCode) |
default void | onLogout (final int errorCode, String info) |
The chat connection listener.
For the occasion of onDisconnected during unstable network condition, you don't need to reconnect manually, the chat SDK will handle it automatically.
There are only two states: onConnected, onDisconnected.
Note: We recommend not to update UI based on those methods, because this method is called on worker thread. If you update UI in those methods, other UI errors might be invoked. Also do not insert heavy computation work here, which might invoke other listeners to handle this connection event.
Register: ```java ChatClient.getInstance().addConnectionListener(mConnectionListener); ``` Unregister: ```java ChatClient.getInstance().removeConnectionListener(mConnectionListener); ```
void io.agora.ConnectionListener.onConnected | ( | ) |
Occurs when the SDK connects to the chat server successfully.
void io.agora.ConnectionListener.onDisconnected | ( | final int | errorCode | ) |
Occurs when the SDK disconnect from the chat server.
Note that the logout may not be performed at the bottom level when the SDK is disconnected.
Common errors are as follows: Error#USER_REMOVED,Error#USER_LOGIN_ANOTHER_DEVICE, Error#SERVER_SERVICE_RESTRICTED,Error#USER_KICKED_BY_CHANGE_PASSWORD and Error#USER_KICKED_BY_OTHER_DEVICE
default void io.agora.ConnectionListener.onLogout | ( | final int | errorCode | ) |
Occurs when the UNDERLYING SDK logs out.
Common errors are as follows: Error#USER_LOGIN_ANOTHER_DEVICE,Error#USER_REMOVED, Error#USER_BIND_ANOTHER_DEVICE,Error#SERVER_SERVICE_RESTRICTED, Error#USER_LOGIN_TOO_MANY_DEVICES,Error#USER_KICKED_BY_CHANGE_PASSWORD, Error#USER_KICKED_BY_OTHER_DEVICE
errorCode |
default void io.agora.ConnectionListener.onLogout | ( | final int | errorCode, |
String | info | ||
) |
Occurs when the UNDERLYING SDK logs out.
errorCode | error code . Common errors are as follows: Error#USER_LOGIN_ANOTHER_DEVICE,Error#USER_REMOVED, Error#USER_BIND_ANOTHER_DEVICE,Error#SERVER_SERVICE_RESTRICTED, Error#USER_LOGIN_TOO_MANY_DEVICES,Error#USER_KICKED_BY_CHANGE_PASSWORD, Error#USER_KICKED_BY_OTHER_DEVICE |
info | error extend info . If errorCode is Error#USER_LOGIN_ANOTHER_DEVICE, info is the user-defined device name of the peer that kicks or squeeches the current device. If the peer device does not have a user-defined device name, the device name of the peer device is called back by default.In other error code scenarios, info is empty. |
default void io.agora.ConnectionListener.onTokenExpired | ( | ) |
Occurs when the token has expired.
Common errors are as follows: Error#TOKEN_EXPIRED,Error#TOKEN_WILL_EXPIRE,
default void io.agora.ConnectionListener.onTokenWillExpire | ( | ) |
Occurs when the token is about to expire.