I'm creating an app for a school project and I have some issues getting data from the Firebase database. I have some data stored in the database that I need to retrieve. However, in the guide I only seem to find information on how to get data when an event is triggered. What I want is for the data to be retrieved automatically e.g. when I open the homescreen of the app or when i scroll down the window to update the homescreen.
It is very possible that there is an explanation to this in the guide, but if so, I have not been able to grasp it. So a thorough description of the solution would be very much appreciated!
Due to the asynchronous nature of Firebase this is the only possible way to retrieve your data.
When you make a request to your Firebase, the data isn't instantly available. When the data becomes available, Firebase will trigger the event and pass you the data. Unfortunately there is no way around this.
People usually deal with this by showing some sort of activity indicator until the data has been retrieved.
I hope this answers your question!