I used the Google login API to request a user profile, I like the display name, avatar. I got the null value of GoogleSignInAccount.getPhotoUrl (), got the value of GoogleSignInAccount.getDisplayName ().
The Gmail account is OK, but there is no private account. the private account is connected with Google gmail, she can see the picture in my Gmail account and in the Google Play application, Google plus too. but why did I get a null value using the Google Sign In account API.
<i>
GoogleSignInOptions.Builder builder = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail();
builder.setAccountName(userAcc);
GoogleSignInOptions gso = builder.build();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, 0, this)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);
private void handleSignInResult(final GoogleSignInResult result) {
if (result.isSuccess()) {
if (getBaseContext() == null) {
return;
}
GoogleSignInAccount acct = result.getSignInAccount();
final String email = acct.getEmail();
final String displayName = acct.getDisplayName();
final Uri uri = acct.getPhotoUrl();
String sUri = null;
if (uri != null) {
sUri = uri.toString();
}
System.out.println("GoogleSignInAccount: getPhotoUrl: " + sUri);
source
share