Get person details in new google sign in Play Services 8.3

后端 未结 3 1991
醉话见心
醉话见心 2020-11-30 09:30

I\'m trying to get a user\'s profile using the new Google Sign In API introduced in play services 8.3. Other than Display Name, Email and Id, I also need user\'s gender.

3条回答
  •  鱼传尺愫
    2020-11-30 10:00

    For getting profile information google introduced the easiest way so far I think!

    GoogleSignInAccount acct = GoogleSignIn.getLastSignedInAccount(getActivity());
    if (acct != null) {
      String personName = acct.getDisplayName();
      String personGivenName = acct.getGivenName();
      String personFamilyName = acct.getFamilyName();
      String personEmail = acct.getEmail();
      String personId = acct.getId();
      Uri personPhoto = acct.getPhotoUrl();
    }
    

提交回复
热议问题