I am seeing a very weird behavior when using updating the Firebase DB from a background service in my Android App. FYI I have SetPersistanceEnabled set to TRUE. My Java API Version is 2.5.0+.
Following is what is happening:
I have a background service started as STICKY. This service receives GCM and on receipt of these messages I do some updates to the Firebase DB. The updates work perfectly fine when the app is running in foreground but as soon as the app is killed the updates are never reflected back to DB online.
I can confirm when App is killed the service restarts itself and also when GCM arrives Firebase UpdateChildren's CompletionListener is called without error which means data has been persisted(I can confirm this based on log statements getting printed on console). But then why I don't see the updates online. I thought because the persistence is enabled it might sync it back once the app again comes online but NO after restarting the app and running it in foreground I still don't see the update getting synced to DB.
Has anyone faced this similar issue. Please let me know if I am doing anything wrong.
BTW I am not using goOnline or goOffline anywhere in the application.
this is FCM, not GCM ...when lacking the Context one probably cannot instance the required objects. simply update the records on the server-side - and then update the local version on the next synchronization.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With