I am trying to redirect user directly to home screen without showing login screen to users. For this I wrote this code,
@Override
protected void onStart() {
super.onStart();
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user != null){
startActivity(new Intent(LoginActivity.this,MainActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK));
}
}
This code works but when I open the app at first it shows my login activity for some second and then redirect to Main activity. But I don't want to show that login activity any more if user already log in.
Here is my screen record: https://youtu.be/j1jsVXwDZtA