@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (Session.getCurrentSession().handleActivityResult(requestCode, resultCode, data)) { return; } super.onActivityResult(requestCode, resultCode, data); }
@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(); } } }
@Override protected void onDestroy() { super.onDestroy(); session.removeCallback(mySessionCallback); }