简体   繁体   中英

How to sync with local database data with online data when app is offline?

I want to build a mobile app where user can upload many tasks which will go to a server through API. after that All the uploaded tasks will be stored locally too. Then user can assign all the tasks from pending to done offline(no internet). There will be a option where user can sync with all the done tasks which is stored locally to sync with the server to keep update with the pending and done tasks. How can i design this mobile app?

All you need is an api to be triggered when your application comes back online.

For syncing you can either use a sync adapter approach which is now deprecated.

Or you can use the latest WorkManager api which provide you with all options like time, internet connection, battery etc based runs and you focus would only be to write a job that runs calls this api.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM