Skip to content Skip to sidebar Skip to footer

FirebaseAuth.getInstance().signOut() Doesn't Signout

I try to signout user from firebase but after i close my app and open again the user is stills connect I tried the regular signout of user from firebase and it not solve the proble

Solution 1:

I think you are being logged out correctly but as you are moving to

LoginActivity.class

Where you might be logging the user back in again you would have to make certain changes in Login activity.


Solution 2:

Why you are using SharedPreferences? If you are maintaining the session with firebase you don't need sharedpreferences. By the way your code seems correct. Try doing the following modification with your intent after calling the logout function.

FirebaseAuth.getInstance().signOut();    
Intent intent = new Intent(getActivity(), LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);

And completely delete your onAuthStateChanged() method (Because I cannot see your complete code, and may be you are messing the things inside this method) so just for testing remove this method, and add the flags to your intent as I said.

If it is working let me know.

Hope this will help you. Thanks


Post a Comment for "FirebaseAuth.getInstance().signOut() Doesn't Signout"