对不起我的英语。
根据新的Google account api
收到Google帐户的用户数据后,用户需要在弹出窗口中选择您的帐户(截图如下):
为此,请使用以下代码:
private void signIn() {
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Log.i("RESULT_", requestCode + " ---- " +resultCode + " ---- " + data);
hideProgressDialog();
// Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
if (requestCode == RC_SIGN_IN) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
handleSignInResult(result);
}
}
它使用对象GoogleSignInOption的以下设置:
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();
问题是 - 有没有办法绕过帐户的选择对话框,即该窗口不显示用户并通过软件代码自动加载列表中的第一个帐户(如果多于一个,或者如果它只有一个??