问题
In Firebase Realtime Database, we can easily manage User presence by keeping a reference to a node and updating it as shown below:
DatabaseRef presenceRef = FirebaseDatabase.getInstance().getReference("disconnectmessage");
presenceRef.onDisconnect().setValue("I disconnected!");
If I want to do the same in Cloud Firestore, is there any way to achieve it?
回答1:
You can easily use both Cloud Firestore and Realtime Database in the same project. For presence, we recommend you still use the Realtime Database to handle it.
来源:https://stackoverflow.com/questions/46582975/managing-online-presence-in-cloud-firestore