Connection exception callback

No callback on connect

Possible reasons:

  1. SDK not initialized. Call connect after initialization.

  2. libRongIMLib.so file doesn’t match the SDK version.
    Download the correct SDK version from the official site and replace the libRongIMLib.so file.

  3. Multiple connect calls in the App layer triggered almost simultaneously may clear the callback.
    Call connect only once during the app lifecycle. The SDK has a reconnection mechanism, so multiple connect calls aren’t needed.

onError callback for connect

The callback includes an error code. Refer to the error code list for details: https://docs.rongcloud.io/android-imlib/code

Note: Android 9.0+ devices don’t support plaintext transmission, only support https.

onTokenIncorrect callback for connect (2.x)

This callback only exists in the 2.x SDK, indicating an invalid/expired token. In 4.x/5.x, it’s merged into onError.

Possible reasons:

  1. Incorrect App Key. Verify the App Key.

  2. Incorrect token.
    RC doesn’t support direct token retrieval by the client. The App Server must request a token from the RC IM Server.
    Ensure the App Key matches the one used by the App Server to get the token.
    Use the Developer Console to check token validity: Developer Console → Operations Management → User Management. See screenshot:
    1551951263101188.png暂无

  3. Expired token.
    Set the token validity period in the Developer Console: Console → Basic Information → App Key. See screenshot:

If the issue persists after checking the above, submit a ticket with the SDK logs from /sdcard/Android/data/package_name/files/rong_log.