This page refers to a deprecated version of Google Sign-In. New projects should use the current version.

Getting Profile Information

After you have signed in a user with Google, you can access the user's age range, language, and public profile information. If you request the email scope, you can also get their email address.

Before you begin

Retrieve profile information for a signed-in user

Use the Plus.PeopleApi.getCurrentPerson method to request profile information the currently signed in user.

You can call the getCurrentPerson method after the GoogleApiClient is connected:

@Override
public void onConnected() {
  ...
  if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) {
    Person currentPerson = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
    String personName = currentPerson.getDisplayName();
    String personPhoto = currentPerson.getImage().getUrl();
    String personGooglePlusProfile = currentPerson.getUrl();
  }
}

For additional profile data that might be available, see com.google.android.gms.plus.model.people.Person

The Plus.PeopleApi.getCurrentPerson method is a native API binding around the people.get API with the special "me" value provided as the user ID.

Retrieve the email address of a signed-in user

You can use the Plus.AccountApi.getAccountName method to get the user's email address that is associated with the connected account. You must declare the permission <uses-permission android:name="android.permission.GET_ACCOUNTS" /> in your AndroidManifest.xml to use this method.

String email = Plus.AccountApi.getAccountName(mGoogleApiClient);