2015-06-06 24 views
1

你好我想唱的谷歌加上我的應用程序和登錄後得到用戶的完整的個人資料生日,名字,姓氏,性別,聯繫電話等如何從我的應用程序中整合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(); 
    } 
} 

我沒有得到完整的個人資料在這裏,請幫助我。 。在此先感謝

+0

可能是他們沒有在他們的個人資料登記的出生名字或日期。 – Shadow

+0

這不是問題@shadow –

+0

那有什麼問題?任何日誌錯誤,或者你不能顯示任何名稱/電子郵件? – Shadow

回答

相關問題