【问题标题】:How to get full profile from integrate google plus in my app?如何从我的应用程序中集成 google plus 获取完整的个人资料?
【发布时间】:2015-06-06 05:45:55
【问题描述】:

您好,我正在尝试在我的应用中使用 google plus 唱歌,登录后获取用户完整的个人资料生日、名字、姓氏、性别、联系号码等

private void getProfileInformation() {
    try {
        if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) {
            Person currentPerson = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
            String personName = currentPerson.getDisplayName();
            String personID = currentPerson.getId();
            String AgeRange  = String.valueOf(currentPerson.getAgeRange());


            String Place = String.valueOf(currentPerson.getPlacesLived());
            String personNamef = String.valueOf(currentPerson.getName()); //Gives First Name and Last Name in Json formay
            int personGender = currentPerson.getGender(); //Gives Gender in int 0:Male, 1:Female
            String personCircle = String.valueOf(currentPerson.getCircledByCount());
            String personPhotoUrl = currentPerson.getImage().getUrl();
            String personGooglePlusProfile = currentPerson.getUrl();
            String email = Plus.AccountApi.getAccountName(mGoogleApiClient);
            if(personGender == 0){
                gen = "Male";
            }
            if(personGender == 1){
                gen = "Female";
            }
            if(personGender == 2){
                gen = "Other";
            }


            Log.e(TAG, "First Name: " + personNamef + ", plusProfile: "
                    + personGooglePlusProfile + ", ID: " + personID
                    + ", AgeRange: " + AgeRange +
                     ", CircledByCount: " + personCircle +

                    ", PlacesLived: " + Place);

            txtName.setText(personName);
            txtEmail.setText(email);
            txtGender.setText(gen);


            // by default the profile url gives 50x50 px image only
            // we can replace the value with whatever dimension we want by
            // replacing sz=X
            personPhotoUrl = personPhotoUrl.substring(0,
                    personPhotoUrl.length() - 2)
                    + PROFILE_PIC_SIZE;

            new LoadProfileImage(imgProfilePic).execute(personPhotoUrl);

        } else {
            Toast.makeText(getApplicationContext(),
                    "Person information is null", Toast.LENGTH_LONG).show();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

我在这里没有完整的个人资料,请帮助我.. 提前致谢

【问题讨论】:

  • 可能是他们没有在个人资料中注册姓名或出生日期。
  • 这不是问题@shadow
  • 那有什么问题呢?任何日志错误或您无法显示任何姓名/电子邮件?
  • @shadow 姓名、电子邮件、头像、性别显示但生日、当前位置、联系电话不显示

标签: android google-plus-signin


【解决方案1】:

Google plus API 不提供任何方法来获取用户的联系电话,即使他们已经公开了!! 更多详情请访问Retrieve phone number from a signed in user profile from google plus login in android

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-14
    • 1970-01-01
    • 2015-02-14
    • 2017-08-27
    • 2018-01-13
    • 1970-01-01
    相关资源
    最近更新 更多