Why isn't onDisconnect in Firebase being triggered?

222 Views Asked by At

I'm trying to build a presence system using firebase. The problem is that onDisconnect is not triggering when I close my app or turn off my network connectivity.

enter image description here

My Code:

 FirebaseDatabase firebase=FirebaseDatabase.getInstance();
        firebase.getReference("Users/"+shared.getString("username","")+"/presence").onDisconnect().setValue("offline");
0

There are 0 best solutions below