Search code examples
javaandroidfirebasedisconnection

Disconnect programmatically from firebase


How to programmatically disconnect the user?

Here is my problem: I know that the maximum of simultaneous connection is 100 with firebase but in my application, I'm retrieving all the data from the database and then I don't need it anymore so is it possible to disconnect the phone from firebase programmatically?


Solution

  • Invoking:

    FirebaseDatabase.getInstance().goOffline();

    is the way to disconnect the connection from firebase programmatically. Putting the call at the end of your onStart callback is going to be the way to go, from the looks of it. Hope that helps.