Skip to main content

You can register multiple listeners.

JIM.getInstance().getConnectionManager().addConnectionStatusListener("main", new IConnectionManager.IConnectionStatusListener() {

/// connection-status change callback
/// - Parameters:
/// - status: updated status
/// - code: connection error code; valid in the JIMConst.ConnectionStatus.FAILURE state and 0 in all other states.
/// - extra: additional information
@Override
public void onStatusChange(JIMConst.ConnectionStatus status, int code, String extra) {
if (status == JIMConst.ConnectionStatus.CONNECTED) {
Log.i("TAG", "SDK connect success");
}
}

/// database-open callback; the local database can be opened to view message history while offline
@Override
public void onDbOpen() {
Log.i("TAG", "onDbOpen");
}

@Override
public void onDbClose() {

}
});