Control Firebase timeout for disconnection

848 Views Asked by At

I got an Android application which uses Firebase.

My records there got a field called "status" which is supposed to save the connectivity status to the server.

I got a BroadcastReceiver which identifies when the internet connection to the application is restored and then I update the status field myself and everything is fine in that direction.

I got a problem when the internet connection is lost. It seems to take a long time for Firebase to identify the connection is lost, and the status field is being updated after a long time. The update itself when disconnected is done like this:

child.child("status").onDisconnect().setValue(ClientStatus.OFFLINE);

This works, but like I said it takes a long time until the onDisconnect() method is actually invoked.

Is there a way to control the timeout for firebase until it decides the connection is lost?

1

There are 1 best solutions below

3
On BEST ANSWER

Unfortunately, there is currently no way to influence the timeout behavior neither in the client SDKs, nor on the Console.