1

Sign In with Google Works good and SignOut Also but when i sign In again it signs in me with the same account which I use Previously to signed In but i want every time i signed out it should ask me all time to choose account with which You want to sign in but my app crashes as i use below code to perform that functionality

 private void SignOut() {
        // Firebase sign out
        auth.signOut();

        // Google sign out
        mGoogleSignInClient.signOut().addOnCompleteListener(this,
                new OnCompleteListener<Void>() {
                    @Override
                    public void onComplete(@NonNull Task<Void> task) {
                        //updateUI(null);
                        Intent intent=new Intent(Welcome.this,MainActivity.class);
                        startActivity(intent);
                    }
                });

}

LogCat

 java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.tasks.Task com.google.android.gms.auth.api.signin.GoogleSignInClient.signOut()' on a null object reference
                                                                                           at com.clone.tracking.tourism.tourismapp.Welcome.SignOut(Welcome.java:123)
                                                                                           at com.clone.tracking.tourism.tourismapp.Welcome.onNavigationItemSelected(Welcome.java:104)

Line 123

mGoogleSignInClient.signOut().addOnCompleteListener(this,

LINE 104

this is where i call  SignOut(); method
Wahdat Jan
  • 3,988
  • 3
  • 21
  • 46

0 Answers0