Beispiel #1
0
  /** Attempts to form a connection to the user-selected host. */
  public static void connectToHost(
      String username,
      String authToken,
      String hostJid,
      String hostId,
      String hostPubkey,
      Runnable successCallback) {
    synchronized (JniInterface.class) {
      if (!sLoaded) return;

      if (sConnected) {
        disconnectFromHost();
      }
    }

    sSuccessCallback = successCallback;
    SharedPreferences prefs = sContext.getPreferences(Activity.MODE_PRIVATE);
    nativeConnect(
        username,
        authToken,
        hostJid,
        hostId,
        hostPubkey,
        prefs.getString(hostId + "_id", ""),
        prefs.getString(hostId + "_secret", ""));
    sConnected = true;
  }