Last active
January 22, 2018 15:38
-
-
Save wajahatkarim3/c47161263461418f73131911ef9cd4d0 to your computer and use it in GitHub Desktop.
Making user online of Firestore and Firebase
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun makeUserOnline(user: UserModel) | |
{ | |
// Firestore | |
var query = FirebaseFirestore.getInstance().collection("users").document(user.userId ?: "") | |
user.apply { | |
online = true | |
last_active = 0 | |
} | |
query.set(user) | |
// Firebase Status | |
var fbquery = FirebaseDatabase.getInstance().getReference("status/" + user.userId).setValue("online") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment