In my Android application I use the Room API to persist data that comes from the network. The app is split into several processes, with one of them responsible for syncing the data (implementing SyncAdapter). The UI is running on a different process, with it's own DAO to access the DB. My issue is that the LiveData I query on the UI process, doesn't get any updates when the SyncAdapter writes new data to the DB. Because the DB is shared between processes, I expected the OnChanged to be called on all processes that have LiveData that reflects the DB, meaning that all processes can observe data base changes
Asked
Active
Viewed 1,643 times
4
-
The question: how do I updates to data I'm observing for all observers? – ArikYa Jul 29 '17 at 16:03
2 Answers
3
enableMultiInstanceInvalidation introduced in room 2.1.0 may help you official docs

U13-Forward
- 69,221
- 14
- 89
- 114

Shweta
- 31
- 2
1
You will need to implement your own IPC mechanism to pass events from process to process. This is not significantly different than using SQLite directly, or using most other observer frameworks (e.g., data binding observables).
Or, switch to having a single process, in which case your existing implementation may work just fine.

CommonsWare
- 986,068
- 189
- 2,389
- 2,491