// 사용자 정보 요청
public void requestMe() {
UserManagement.getInstance().me(new MeV2ResponseCallback() {
@Override
public void onFailure(ErrorResult errorResult) {
int result = errorResult.getErrorCode();
if (result==ApiErrorCode.CLIENT_ERROR_CODE){
Toast.makeText(getApplicationContext(), "네트워크 연결이 불안정합니다. 다시 시도해 주세요.", Toast.LENGTH_SHORT).show();
finish();
} else {
Toast.makeText(getApplicationContext(),"로그인 도중 오류가 발생했습니다: "+errorResult.getErrorMessage(),Toast.LENGTH_SHORT).show();
}
}
@Override
public void onSessionClosed(ErrorResult errorResult) {
Toast.makeText(getApplicationContext(),"세션이 닫혔습니다. 다시 시도해 주세요: "+errorResult.getErrorMessage(),Toast.LENGTH_SHORT).show();
}
@Override
public void onSuccess(MeV2Response result) {
Intent intent = new Intent(getApplicationContext(),logoutActivity.class);
UserAccount kakaoAccount = result.getKakaoAccount();
if(kakaoAccount!=null){
//이메일
String email = kakaoAccount.getEmail();
Log.v("KAKAO_API", "email: " + email);
if(email != null){
Log.v("KAKAO_API", "email: " + email);
} else if(kakaoAccount.emailNeedsAgreement()==OptionalBoolean.TRUE){
}else {
}
}
//프로필
Profile profile = kakaoAccount.getProfile();
Log.v("KAKAO_API", "email: " + profile);
if (profile!=null){
Log.v("KAKAO_API", "nickname: " + profile.getNickname());
Log.v("KAKAO_API", "profile image: " + profile.getProfileImageUrl());
Log.v("KAKAO_API", "thumbnail image: " + profile.getThumbnailImageUrl());
} else if(kakaoAccount.profileNeedsAgreement()==OptionalBoolean.TRUE){
} else {
}
startActivity(intent);
finish();
}
});
}
}
}