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)