Documentation
Real-time Messaging
API Reference
Agora RTM Java API Reference for Android
Agora RTM Java API Reference for Android
◆ CONNECTION_STATE_DISCONNECTED
int io.agora.rtm.RtmStatusCode.ConnectionState.CONNECTION_STATE_DISCONNECTED = 1 |
1: The initial state. The SDK is disconnected from the Agora RTM system.
When the user calls the login method, the SDK starts to log in the Agora RTM system, triggers the onConnectionStateChanged callback, and switches to the CONNECTION_STATE_CONNECTING state.
◆ CONNECTION_STATE_CONNECTING
int io.agora.rtm.RtmStatusCode.ConnectionState.CONNECTION_STATE_CONNECTING = 2 |
2: The SDK is logging in the Agora RTM system.
◆ CONNECTION_STATE_CONNECTED
int io.agora.rtm.RtmStatusCode.ConnectionState.CONNECTION_STATE_CONNECTED = 3 |
3: The SDK has logged in the Agora RTM system.
-
If the connection between the SDK and the Agora RTM system is interrupted because of network issues, the SDK triggers the onConnectionStateChanged callback, and switches to the CONNECTION_STATE_RECONNECTING state.
-
If the login is banned by the server because, for example, another instance logs in the Agora RTM system with the same user ID, the SDK triggers the onConnectionStateChanged callback and switches to the CONNECTION_STATE_ABORTED state.
-
If the user calls the logout method successfully logs out of the Agora RTM system, the SDK triggers the onConnectionStateChanged callback and switches to the CONNECTION_STATE_DISCONNECTED state.
◆ CONNECTION_STATE_RECONNECTING
int io.agora.rtm.RtmStatusCode.ConnectionState.CONNECTION_STATE_RECONNECTING = 4 |
4: The connection state between the SDK and the Agora RTM system is interrupted due to network issues, and the SDK keeps re-logging in the Agora RTM system.
-
If the SDK successfully logs in the Agora RTM system again, it triggers the onConnectionStateChanged callback and switches to the CONNECTION_STATE_CONNECTED state. The SDK automatically adds the user back to the channel(s) he or she was in when the connection was interrupted, and synchronizes the local user's attributes with the server.
-
If the SDK fails to log in the Agora RTM system again, the SDK stays in the CONNECTION_STATE_RECONNECTING state.
◆ CONNECTION_STATE_ABORTED
int io.agora.rtm.RtmStatusCode.ConnectionState.CONNECTION_STATE_ABORTED = 5 |
5: The SDK gives up logging in the Agora RTM system, mainly because another instance has logged in the Agora RTM system with the same user ID.
Call the logout method before calling the login method to log in the Agora RTM system again.