コード例 #1
0
  void reestablishSession() {
    mConnectionState = ImConnection.LOGGING_IN;

    ContentResolver cr = mService.getContentResolver();
    if ((mConnection.getCapability() & ImConnection.CAPABILITY_SESSION_REESTABLISHMENT) != 0) {
      HashMap<String, String> cookie = querySessionCookie(cr);
      if (cookie != null) {
        Log.d(TAG, "re-establish session");
        try {
          mConnection.reestablishSessionAsync(cookie);
        } catch (IllegalArgumentException e) {
          Log.e(TAG, "Invalid session cookie, probably modified by others.");
          clearSessionCookie(cr);
        }
      }
    }
  }