I am using Firebase android sdk v.9.0.2 and can't get past the registration for now. I am adding an auth state listener and removing it on successful registration. Yet it is called multiple times. This is what i'm getting in my logs:
D/FirebaseAuth: Notifying listeners about a sign-out event.
D/FirebaseApp: Notifying auth state listeners.
D/FirebaseApp: Notified 0 auth state listeners.
D/ActivityRegister: auth listener called
D/FirebaseAuth: Notifying listeners about user ( bwVX8jBbZvYcIj28hYsGZCcbzxi1 ).
D/FirebaseApp: Notifying auth state listeners.
D/FirebaseApp: Notified 0 auth state listeners.
D/ActivityRegister: auth listener called
D/FirebaseAuth: Notifying listeners about user ( bwVX8jBbZvYcIj28hYsGZCcbzxi1 ).
D/FirebaseApp: Notifying auth state listeners.
D/FirebaseApp: Notified 1 auth state listeners.
The "D/ActivityRegister: auth listener called" log is inside the listener iteself. As you can see, when Firebase notifies 0 listeners, it is actually called. And when it shows 1 listener, the listener doesn't get called at all. Is there any workaround for this?
Fixes are not expected. That closed issue. https://github.com/firebase/quickstart-android/issues/80
You can find when this method is triggered here:
Firebase Reference - AuthStateListener
I handle this function trigger with an switch
and only use the "Login_Attempt" and "Register_Attempt" (to send verification email) cases ignoring the rest of them. Just create a String
variable (and i.e. when user clics Sign_In button, set it as "Login_Attempt")
BR
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With