Answers for "how to check if user is logged in firebase android and then load another activity"

0

how to check if user is logged in firebase android and then load another activity

private FirebaseAuth firebaseAuth;
 FirebaseAuth.AuthStateListener mAuthListener;
    firebaseAuth = FirebaseAuth.getInstance();

      mAuthListener = new FirebaseAuth.AuthStateListener(){
                @Override
                public  void  onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth){
            FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
        if(user!=null){
        Intent intent = new Intent(LoginActivity.this, MainActivity.class);
        startActivity(intent);
        finish();
}
                }


            };
Posted by: Guest on May-13-2020

Code answers related to "how to check if user is logged in firebase android and then load another activity"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language