qbix qbix - 2 months ago 7x
Android Question

Why Two Methods for FirebaseDatabase Client Offline?

FirebaseDatabase offers two methods to take a client offline:


Manually disconnect the Firebase Database client from the server and
disable automatic reconnection. Note: Invoking this method will impact
all Firebase Database connections.


Shuts down our connection to the Firebase Database backend until
goOnline() is called.

A call to
produces the expected results:

  1. ValueEventListener
    for ".info/connected" fires for the disconnect

  2. OnDisconnect
    action executes

  3. ValueEventListener
    s for remote changes do not fire, those for local changes do

  4. CompletionListener
    s do not fire

A call to
seems to have no effect. None of the behavior listed above occurs. Is it broken? If not, how does it differ from the other


This was an oversight in the 9.x release. FirebaseDatabase.getInstance().goOffline() / goOnline() are the correct methods to use and DatabaseReference.goOffline() / goOnline() are indeed broken and will be removed in a future release. Sorry for the confusion!