您好我正在尝试在我的应用中加入google plus并在登录后获取用户完整个人资料生日,firstName,lastname,性别,联系电话等
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();
}
}
我在这里没有得到完整的个人资料请帮帮我..先谢谢
答案 0 :(得分:1)
Google Plus API无法提供任何获取用户联系电话的方式,即使他们已将其公开! 有关详细信息,请访问Retrieve phone number from a signed in user profile from google plus login in android