I have an application Android
with a connection to Firebase
for the data model.
When starting the application, I must access the data, for this a addValueEventListener
is used, what it does is to listen if changes are made in Firebase
to represent them in the application.
My problem is that I do not know how to make you listen to the application all the time, if I put it in activity
, when I change to another activity
, then stop listening and that is not the joke. I tried to do it with a BroadcastReciever
but the data is obtained in disorder and when the entries in the local database, a NullPointerException
is generated since data from tables that require the key of another record that has not yet been entered