GoogleSignInAccount getPhotoUrl()返回null [英] GoogleSignInAccount getPhotoUrl() return null
本文介绍了GoogleSignInAccount getPhotoUrl()返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试从已登录的个人资料中获取照片.但始终返回null.名称和电子邮件返回值,仅对照片有问题.
Trying to get photo from signed in profile. But always return null. Name and email return values, trouble only with photo.
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestProfile()
.requestEmail()
.build();
mGoogleApiClient = new GoogleApiClient.Builder(StartActivity.this)
.enableAutoManage(StartActivity.this, StartActivity.this)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
acct = gResult.getSignInAccount();
String name = acct.getDisplayName(); //okay, value != null
String email = acct.getEmail(); //okay, value != null
Uri photoUri = acct.getPhotoUrl() //not okay, value == null
为什么会这样?帐户已签名,电子邮件和姓名都可以,但是照片总是失败.
Why does it happen so? Account signed, email and name got, but photo always fail.
推荐答案
查看全文