-1
Twitter集成Twitter集成 - 如何獲取用戶登錄詳細信息?
我想在成功登錄後獲取用戶電子郵件ID,名字,姓氏。
@Override
public void onClick(View v)
AppConstants.auth_adapter_Twitter = new SocialAuthAdapter(new ResponseListener());
AppConstants.auth_adapter_Twitter.authorize(getActivity(), SocialAuthAdapter.Provider.TWITTER);
}
private final class ResponseListener implements DialogListener {
@Override
public void onComplete(Bundle values) {
AppConstants.auth_adapter_Twitter.getUserProfileAsync(new ProfileDataListener());
}
@Override
public void onError(SocialAuthError error) {
System.out.println("ResponseListener " + error);
}
@Override
public void onCancel() {
System.out.println("Dialog Cancelled");
}
@Override
public void onBack() {
System.out.println("Dialog Closed by pressing Back Key");
}
private final class ProfileDataListener implements SocialAuthListener<Profile> {
@Override
public void onExecute(String provider, Profile t) {
System.out.println("ProfileDataListener execute");
System.out.println("social_id " + t.getValidatedId());
System.out.println(t.getDisplayName() + "firstname " + t.getFirstName());
System.out.println(" email " + t.getEmail());
System.out.println("lastname " + t.getLastName());
System.out.println("provider " + provider);
}
@Override
public void onError(SocialAuthError e) {
System.out.println("SocialAuthError " + e);
}
}
我使用上面的代碼進行登錄的Twitter帳戶獲得登錄細節,但有一些問題,請幫我
「有一些問題」。那麼可能告訴我們關於這個問題? –
上面的代碼工作正常,但m得到電子郵件,姓,名始終爲空 – chetna