Hello I'm using firebase and google sign in. Everything works fine, but I don't know how to show "choose account" dialog. It doesn't appear when user isn't in firebase auth users and when it is. I would like to show this dialog. This is how I create auth (it is in fragment)
gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getActivity().getResources().getString(R.string.key))
.requestEmail()
.build();
mGoogleApiClient = new GoogleApiClient.Builder(getActivity())
.enableAutoManage(((AppCompatActivity)getActivity()), this)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
// and start activity
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);
That's because you didn't sign out your google account (not Firebase). Try to sign out your google account:
signOutButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
firebaseAuth.signOut();
signInClient.signOut(); //here
nameTextView.setText("Google Account Name");
Toast.makeText(view.getContext(), "Sign out successfully", Toast.LENGTH_SHORT).show();
}
});
当设备中设置了不同的帐户时,此对话框会自动出现。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.