Android 应用程序中的 Google+ API 签名问题 - 在 google 登录成功结果后,我使用 google+ api 在以下方法中获取“NULL”值登录
代码
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.requestProfile()
.requestScopes(new Scope(Scopes.PROFILE))
.build();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, this)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
@Override
public void onConnected(@Nullable Bundle bundle) {
googleSignOut();
}
@Override
public void onConnectionSuspended(int i) {
}
})
.build();
结果:
if (result.isSuccess()) {
String personName = acct.getDisplayName();
String name=acct.getGivenName();
}
在上述结果代码中都返回空值。
如何获取姓名、名字或姓氏。