Ejemplo n.º 1
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (Session.getCurrentSession().handleActivityResult(requestCode, resultCode, data)) {
      return;
    }

    super.onActivityResult(requestCode, resultCode, data);
  }
Ejemplo n.º 2
0
  @Override
  protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    SharedPreferences preferences = getSharedPreferences("pref", MODE_PRIVATE);
    Long id = preferences.getLong("id", 0);

    if (id != 0) {
      Intent i = new Intent(LoginActivity.this, MainActivity.class);
      startActivity(i);
      finish();
    }

    Session.initialize(this, AuthType.KAKAO_TALK);

    setContentView(R.layout.login_activity);
    // 로그인 버튼을 찾아온다.
    loginButton = (LoginButton) findViewById(R.id.com_kakao_login);

    session = Session.getCurrentSession();
    session.addCallback(mySessionCallback);

    // getHash();

    if (session.isClosed()) {
      loginButton.setVisibility(View.VISIBLE);
    } else {
      loginButton.setVisibility(View.GONE);
      if (session.implicitOpen()) {
        loginButton.setVisibility(View.GONE);
      } else {
        // Toast.makeText(getApplicationContext(), "service unavailable",
        // Toast.LENGTH_SHORT).show();
        finish();
      }
    }
  }