In my app there are two type of users "Viewer" and "Controller" so my app starts with an activity where user select user type (UserTypeActivity
). I want to show this activity only if user is not signed in to app. In Its on start method I'm checking if the user is signed in or not based on this I send the user to MainActivity
or signInActivity
Now when a user click logout button from mainActivity
I redirect it to this UserTypeActivity
because user can switch between viewer and controller. The problem is when I sign out the user according to the API's documentation the UserTypeActivity
send the user to MainActivity
saying user is already logged in.
I'm Using this code for logout.
AuthUI.getInstance()
.signOut(this)
.addOnCompleteListener(new OnCompleteListener<Void>() {
public void onComplete(@NonNull Task<Void> task) {
// user is now signed out
startActivity(new Intent(MainActivityViewer.this,
UserTypeActivity.class));
finish();
}
});
When signing in I have set the .setIsSmartLockEnabled(false)
I'm using FirebaseAuth.AuthStateListener
approach for signing in. So please let me know how can I prevent the app to Auto-SignIn if user press logout button. Also let me know if any other code part I have to show.
Regards