architecture-samples
architecture-samples copied to clipboard
[question] [todo-mvp] [todo-mvp-clean] Where to place BroadcastReceiver?
I have a BroadcastReceiver implementation that receives network connection events. its declared in the AndroidManifest.xml and is called by Android automatically when network events occur.
For both todo-mvp and todo-mvp-clean samples, just wondering:
- Where should my BroadcastReceiver be placed?
- If my BroadcastReceiver needs to write to the database, whats the best way of doing this?
- If my BroadcastReceiver needs to update the UI, whats the best way of doing this?
For todo-mvp-clean, it can be implemented as ListenConnectivity UseCase. The problem with that would be receiving continuous updates from UseCase. We can solve this with this pull request https://github.com/googlesamples/android-architecture/pull/183