0

I did everything as demonstrated in this question & configured sign out event like this:

public static void SignOut() {
    // Google sign out
    Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(
            new ResultCallback<Status>() {
                @Override
                public void onResult(@NonNull Status status) {
                    if (status.isSuccess())
                        Log.wtf("success", "signed out");
                    if (status.isInterrupted())
                        Log.wtf("interrupted", "not signed out");
                    if (status.isCanceled())
                        Log.wtf("cancelled", "sign out cancelled");
                }
            });
}

However, following error is thrown when SignOut() is called:

java.lang.IllegalStateException: GoogleApiClient is not connected yet. at com.google.android.gms.internal.zzaas.zzb(Unknown Source) at com.google.android.gms.internal.zzaav.zzb(Unknown Source) at com.google.android.gms.internal.zzaat.zzb(Unknown Source) at com.google.android.gms.auth.api.signin.internal.zze.zza(Unknown Source) at com.google.android.gms.auth.api.signin.internal.zzc.signOut(Unknown Source)

Before SignOut(), mAuth.signOut() is invoked.

How can I tackle this problem?

Thanks.

Community
  • 1
  • 1
Mirjalal
  • 1,292
  • 1
  • 17
  • 40

1 Answers1

0

Just put this code m facing same problem after this signout from google account done successfully..

Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(
    new ResultCallback<Status>() {
        @Override
        public void onResult(Status status) {
            FirebaseAuth.getInstance().signOut();
            Intent i1 = new Intent(MainActivity.this, GoogleSignInActivity.class);
            startActivity(i1);
            Toast.makeText(MainActivity.this, "Logout Successfully!", Toast.LENGTH_SHORT).show();
        }
    });
legoscia
  • 39,593
  • 22
  • 116
  • 167
krunal patel
  • 25
  • 1
  • 5