Skip to content Skip to sidebar Skip to footer

Firebase Callbacks Work During Testing But Not During Runtime

I'm using Firebase in an Android app. The app sets up something like a groupchat and allows users to join. The users get a key and can then connect themselves to the corresponding

Solution 1:

The reason is that Firebase always calls its callbacks from the main thread.

The "main" thread in my tests is called something like "junittestrunnerXXX". And Firebase creates a new thread called "main" to call the callbacks.

At runtime, the "main" thread is the actual "main" thread. If I call get() on that, it is blocked for good. Firebase checks if this thread exists and since it already exists and since it is blocked, nothing happens.

Post a Comment for "Firebase Callbacks Work During Testing But Not During Runtime"