I am using AlarmManager that invokes BroadcastReceiver every 30 minutes. The receiver downloads updates from web and adds new data into the database. When this happens, I would like to notify some other objects, that the data in database changed (to drop cache, refresh GUI etc.).
Usually, I would use observer pattern for this, but since BroadcastReceiver is stateless, I can't keep track of observers between receiver invocations. I can't really find some good solution of this, what would you suggest? Maybe, there is some android specific solution to this that I didn't manage to find...
Thanks for your help!
A BroadcastReceiver
should itself do very little. Use it to fire an Intent
at the Service
of your choice, where all your state and resources and etc. are available to you.