BLOG main image
분류 전체보기 (74)
Cocos2d (9)
낙서장 (4)
스토리지 (1)
안드로이드 (54)
유용한링크 (1)
모바일게임 (2)
추천앱 (1)
아이폰 (0)
맛집/여행 (1)
ナイトウェアメンズ
ナイトウェアメンズ
割烹着 オシャレ
割烹着 オシャレ
klicken Sie einfach auf die bi..
klicken Sie einfach auf die bi..
スポーツ
スポーツ
サンダル
サンダル
285,523 Visitors up to today!
Today 3 hit, Yesterday 15 hit
daisy rss
tistory 티스토리 가입하기!
2016.03.03 10:45
  

https://developers.kakao.com/docs/android 참고.. 디버그 키와 릴리즈 키를 잘 적어줘야 동작합니다.


public class KakaoLogIn extends Activity {


RbPreference pref;

private SessionCallback callback;


@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);


callback = new SessionCallback();

Session.getCurrentSession().addCallback(callback);

Session.getCurrentSession().checkAndImplicitOpen();


}


private class SessionCallback implements ISessionCallback {


@Override

public void onSessionOpened() {

Log.d("myLog", "onSessionOpened " + "onSessionOpened");

redirectSignupActivity();

}


@Override

public void onSessionOpenFailed(KakaoException exception) {

Log.d("myLog", "onSessionOpenFailed " + "onSessionOpenFailed");


if (exception != null) {

Logger.e(exception);

}

}

}


@Override

protected void onActivityResult(int requestCode, int resultCode, Intent data) {

Log.d("myLog", "onActivityResult11 " + "onActivityResult11");


if (Session.getCurrentSession().handleActivityResult(requestCode,

resultCode, data)) {

Log.d("myLog", "onActivityResult " + "onActivityResult");

return;

}


super.onActivityResult(requestCode, resultCode, data);

}


@Override

protected void onDestroy() {

super.onDestroy();

Session.getCurrentSession().removeCallback(callback);

}


protected void redirectSignupActivity() {

Log.d("myLog", "redirectSignupActivity " + "redirectSignupActivity");

requestMe();

// final Intent intent = new Intent(this, SampleSignupActivity.class);

// startActivity(intent);

// finish();

}


private void requestMe() {

UserManagement.requestMe(new MeResponseCallback() {

@Override

public void onFailure(ErrorResult errorResult) {

String message = "failed to get user info. msg=" + errorResult;


}


@Override

public void onSessionClosed(ErrorResult errorResult) {

}


@Override

public void onSuccess(UserProfile userProfile) {

Log.d("myLog", "userProfile" + userProfile.getId());

Log.d("myLog", "userProfile" + userProfile.getNickname());

Log.d("myLog",

"userProfile" + userProfile.getThumbnailImagePath());

}


@Override

public void onNotSignedUp() {

}

});

}


}

Name
Password
Homepage
Secret