qbix qbix - 1 year ago 92
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

Answer Source

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!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download