我想检查用户是否使用Google登录,但为什么mGoogleApiClient.isConnected
的值总是 false ?我联系了onStart
。
在onStart
@Override
protected void onStart() {
super.onStart();
mGoogleApiClient.connect();
}
的onCreate
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, this)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.addApi(Plus.API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
检查谷歌登录的条件
Log.i("TAG", "onCreate: google apiclient --> "+mGoogleApiClient);
Log.i("TAG", "onCreate: google apiclient --> "+mGoogleApiClient.isConnected());
if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
showSocialUserDetail("google");
} else {
Log.i("TAG", "onCreate: google not login");
}