Ich war mit Google Anmelden API, um Benutzerprofil, likes Benutzer Anzeigename, Avatar Foto anfordern. Ich habe null Wert GoogleSignInAccount.getPhotoUrl(), bekam Wert GoogleSignInAccount.getDisplayName().Google Anmelden API - erhalten Foto Uri ist null
Gmail-Konto in Ordnung, aber Privatkonto ist nicht. Das private Konto ist mit Google Gmail verknüpft, es kann das Bild in meinem Google Mail-Konto und in der Google Play Store App, Google plus, ebenfalls sehen. Aber warum habe ich keinen Wert mit der Verwendung der Google Anmelde-API erreicht?
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);
Bitte überprüfen Sie, ob Ihr Google-Konto Google+ Profilbild oder nicht gehabt hat. – Rgv
Ich habe auf Google+ Profil überprüft, es hat Profilbild. – Joyofio987
Jetzt in Ordnung. Ich muss das Konto von meinem Gerät entfernen und dann das Konto hinzufügen. Vielen Dank!! :) – Joyofio987