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

[Question] Any examples of offline data saving to your backend using Room

Open rileymd88 opened this issue 7 years ago • 1 comments

I would like to do the following:

If I have a network connection then write new data to my backend and then make network call and pull data into Room DB, else if I have no network connection then write data into Room DB and then only write new data to my backend when I have a network connection.

Hope this makes sense.

Thanks, R

rileymd88 avatar Sep 20 '17 14:09 rileymd88

@rileymd88 , Why don;t you write all new data to the local db (i.e. room), then use a sync adapter to periodically (given connectivity etc.) sync the local db with the back end?

Some links that could prove useful: https://developer.android.com/training/sync-adapters/index.html https://developer.android.com/training/sync-adapters/creating-sync-adapter.html https://developer.android.com/training/sync-adapters/running-sync-adapter.html

andre-artus avatar Oct 01 '17 16:10 andre-artus