architecture-samples icon indicating copy to clipboard operation
architecture-samples copied to clipboard

[question] [todo-mvp] [todo-mvp-clean] Where to place BroadcastReceiver?

Open rory-work opened this issue 10 years ago • 1 comments

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:

  1. Where should my BroadcastReceiver be placed?
  2. If my BroadcastReceiver needs to write to the database, whats the best way of doing this?
  3. If my BroadcastReceiver needs to update the UI, whats the best way of doing this?

rory-work avatar Sep 23 '16 10:09 rory-work

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

gokhanbarisaker avatar Sep 23 '16 10:09 gokhanbarisaker