Reputation: 188
I would like to be able to display the display name of the google account. With GoogleAccountCredential I can obtain the email. How can I get the displayName from GoogleAccountCredential (email)?
Upvotes: 1
Views: 359
Reputation: 1220
You can use GoogleSignInAccount for that:
OptionalPendingResult<GoogleSignInResult> opr = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
if (opr.isDone()) {
GoogleSignInResult signInResult = opr.get();
GoogleSignInAccount account = result.getSignInAccount();
String displayName = account.getDisplayName();
String givenName = account.getGivenName();
String familyName = account.getFamilyName();
}
Upvotes: 1