I am using Firebase for Android for the chat component of our application. I'm having trouble figuring out how to reliably implement status updates in every chat message. For example, showing "Sending .." when the chat is synchronized with the server and has feedback with success after synchronization.
I have an onChildAdded listener that sends messages to my adapter. However, this listener starts immediately when each node is added locally and I cannot check the status of each node
My current solution is to save a set of node keys and add keys whenever I click on Firebase. Then in the setValue callback, I remove the node key from the set. However, this is very unreliable, as the nodes can synchronize when the calling activity has been destroyed, etc.
I am wondering if there is an easier way to check if each node is synchronized with the server?
Thanks!
source share