Firestore Tutorial Part 4 – SNAPSHOT LISTENER – Android Studio Tutorial
In part 4 of the Firestore tutorial, we add an EventListener to our DocumentReference with the addSnapshotListener method. In it’s onEvent method we can get real time updates as soon as something changes in our document. The same as in our get method we get passed a DocumentSnapshot that contains the data of our document.
We register this EventListener in onStart and unregister it in onStop, either by saving a reference to the ListenerRegistration or simply by passing our activity to the addSnapshotListener method.
Watch the whole playlist:
Code for this part:
https://gist.github.com/codinginflow/7d2016f790740dc1298d9460aedb4ea2
____________________
💻 Find the BEST programming tutorials on TutHub:
https://tuthub.io
⭐ Get my MVVM Caching Course now:
https://codinginflow.com/caching
❗ Subscribe to the channel:
https://www.youtube.com/c/codinginflo…
📨 Subscribe to the Coding in Flow newsletter:
https://codinginflow.com/newsletter
❓ Join our free developer community:
https://discord.gg/TSnMvmc
📣 Follow Coding in Flow on other sites:
Facebook: https://www.facebook.com/codinginflow
Instagram: https://www.instagram.com/codinginflow
TikTok: https://www.tiktok.com/@codinginflow
Twitter: https://twitter.com/codinginflow
Github: https://github.com/codinginflow
💰 Business requests, sponsoring, etc.: info@codinginflow.com
Views :42863
android studio