如何从Google登录名获取生日?

时间:2018-07-24 09:59:26

标签: android gmail

我无法通过Google登录名获取出生日期和性别,因此请提出任何建议,让我可以通过Google登录名检索数据

1 个答案:

答案 0 :(得分:0)

Try This

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
    if (requestCode == RC_SIGN_IN) {
        GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
        handleSignInResult(result);

        // G+
        Person person  = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
        Log.i(TAG, "--------------------------------");
        Log.i(TAG, "Display Name: " + person.getDisplayName());
        Log.i(TAG, "Gender: " + person.getGender());
        Log.i(TAG, "AboutMe: " + person.getAboutMe());
        Log.i(TAG, "Birthday: " + person.getBirthday());
        Log.i(TAG, "Current Location: " + person.getCurrentLocation());
        Log.i(TAG, "Language: " + person.getLanguage());
    }
}