Skip to content

Instantly share code, notes, and snippets.

@wajahatkarim3
Created January 22, 2018 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wajahatkarim3/85def65f3b5b1e71a0d7b879cbaf1628 to your computer and use it in GitHub Desktop.
Save wajahatkarim3/85def65f3b5b1e71a0d7b879cbaf1628 to your computer and use it in GitHub Desktop.
The onDisconnect() hook to make user offline
fun makeUserOnline(user: UserModel)
{
// Adding on disconnect hook
FirebaseDatabase.getInstance().getReference("/status/" + user.userId)
.onDisconnect() // Set up the disconnect hook
.setValue("offline");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment