I have implemented Google sign-in in my application. When I tap the sign in with google button my screen is as the screenshot displayed below. Lists all accounts signed in my phone.Screenshot

Then I press my Home button and my app goes to background. After that when I select my app from background the same screen exists like in the screenshot. I want to dismiss this account chooser screen whenever i goes to background and then comes back. I want my Home activity screen to be displayed when I goes to background and comes back. Whats the solution for this friends?

EDITED : This is how the account picker is started ..

private void signInWithGoogle() {
    Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
    startActivityForResult(signInIntent, RC_SIGN_IN);
}

and the callback of this intent is received in

    @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
    if (requestCode == RC_SIGN_IN) {
        GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
        handleSignInResult(result);
    }
}

Edited 2 This is how I call the signInWithGoogle() method

            @Override
public void onClick(View view) {
        switch (view.getId()) {
            case R.id.signInWithGoogleBtn:
                isGsigninInProgress = true;
                signInWithGoogle();
                break;
        }
    }
}
1

There are 1 best solutions below

3
On
@Override
public void onResume(){
    super.onResume()
    if(google_picker.isShowing(){
        google_picker.dismiss()
    }
}

Whenever the app is resumed this will close your picker if it is open