DEV Community

Stephen Muindi
Stephen Muindi

Posted on

Answer: How do I retrieve user information once the user is created and navigate to a different screen

By the time your val currentUser = mAuth.currentUser runs, the user may not have been set yet. If you want to make sure that you get notified of the user, use an auth state change listener:

mAuth.addAuthStateListener(new FirebaseAuth.AuthStateListener() {
    @Override
    public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
        currentUser = mAuth.getCurrentUser()
        currentUserID

Top comments (0)