Is there a way to notify the application directly if you delete a user from firebase using the firebase console? I have tried with an authlistener but the application does not notice the change in current user when I delete the user. I have to reinstall the application for the application to notice that there is no user anymore? Is there a way to solve this?
What I have tried
override fun getFirebaseAuthState() = callbackFlow {
val authStateListener = FirebaseAuth.AuthStateListener { auth ->
trySend(auth.currentUser == null)
}
auth.checkIfUserExists().addAuthStateListener(authStateListener)
awaitClose {
auth.checkIfUserExists().removeAuthStateListener(authStateListener)
}
}
The viewModel calling it
init {
getAuthState()
}
fun getAuthState() = liveData{
useCases.getAuthState().collect{response ->
emit(response)
}
}