Skip to main content

Initialization

Initialize the SDK in the Application’s onCreate method:

Advanced Initialization

You can also initialize with custom options:

Server Configuration

Listen for events to get connection server IP and Port:
Return the IP of the IM communication end and the TCP port of the IM communication end. For distributed systems, call the interface to get IP and Port before returning.

Connection Management

Connect

Disconnect

Parameters:
  • isLogout:
    • true: SDK will no longer reconnect
    • false: SDK maintains reconnection mechanism

Connection Status Monitoring

Remove Connection Status Listener

Connection Status Types

Best Practices

1. Application Lifecycle Management

2. Activity Lifecycle Integration

3. Network State Monitoring

Troubleshooting

Common Issues

  1. Connection Failed
    • Check if server IP and port are correct
    • Verify network connectivity
    • Ensure user credentials are valid
  2. Frequent Disconnections
    • Check network stability
    • Verify server availability
    • Review connection timeout settings
  3. Kicked Offline
    • Handle gracefully by redirecting to login
    • Clear user session data
    • Notify user about the logout

Next Steps

Message Handling

Learn how to handle message sending and receiving

Channel Management

Manage channels and groups

Conversation Management

Handle conversation lists

Advanced Features

Explore advanced features and configuration