Getting Profile Information

After you have signed in a user with Google, if you configured Google Sign-In, with the DEFAULT_SIGN_IN parameter or the requestProfile method, you can access the user's basic profile information. If you configured Google Sign-In with the requestEmail method, you can also get their email address.

Before you begin

Retrieve profile information for a signed-in user

Use the GoogleSignIn.getLastSignedInAccount method to request profile information for the currently signed in user.

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();

For additional profile data that might be available, see GoogleSignInAccount. Note that any of the profile fields can be null, depending on which scopes you requested and what information the user's profile includes.