as the title, I use OnDisconnect to make presence feture. I did a test :

  1. I open app when has internet connection -> it works fine and the user online now.
  2. I turn off the internet ( both Cellular and Wifi ) and close the app -> the OnDisconnect should fire in a few minutes, but it did not.

I read this post : Firebase: when onDisconnect event fire?

@Frank said that "So in that case you just have to be a bit more patient.", but I have been waiting for a hour, it still does not fire.

so How long we should wait for it ? at least how can we know it will fire or not ?

this is my code :

  if (getMyUID()!=null){
            ROOT_REF.child(CHILD_USERS)
                    .child("userid")
                    .child("active").setValue(Calendar.getInstance().getTimeInMillis()+"");

            ROOT_REF.child(CHILD_USERS)
                    .child("userid")
                    .child("active").onDisconnect()
                    .setValue(Calendar.getInstance().getTimeInMillis()+"");
        }

0 Answers