title: How does the firebase AuthStateListener work?
body: <p>I am developing an android app using firebase for user management and authentication. I was wondering when the auth state listener gets called and how it works, as in my app I have a bug related to this.</p>
  
  <p>Here is an example of one in my android app:</p>
  
  <pre><code>mAuthListener = new FirebaseAuth.AuthStateListener() {
              @Override
              public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                  FirebaseUser user = firebaseAuth.getCurrentUser();
                  if (user != null) {
                      // Sign in logic here.
                  }
              }
          };
  </code></pre>
  
  <p>How does the <code>AuthStateListener</code> work and when does it get called?</p>