简体   繁体   English

应用离线时如何将本地数据库数据与在线数据同步?

[英]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.我想构建一个移动应用程序,用户可以在其中上传许多任务,这些任务将 go 通过 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.您只需要一个 api 即可在您的应用程序重新联机时触发。

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.或者您可以使用最新的 WorkManager api,它为您提供所有选项,例如时间、互联网连接、电池等基于运行的选项,您只需编写一个运行调用此 api 的作业。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将Firebase离线数据与在线数据同步 - How to sync Firebase offline data with online data 当应用离线时,将输入的内容存储在本地缓存中,然后在应用重新上线时与 Firebase 实时数据库同步 - when app is offline, store the entered in local cache and then sync with firebase real time database when app is back online 如何离线和在线同步android sqlite数据库和mysql数据库之间的数据? - How to sync data between android sqlite database and mysql database offline and online? android 应用离线时如何保持本地数据库存储数据? - How to keep a local database to store data in an android app when the app is offline? Android离线模式(应用程序在线时同步数据) - Android offline mode (syncing data when app goes online) 当应用程序处于终止状态时数据脱机同步 - data offline sync when app is in terminated state also Android App是否可以离线和在线工作? 我应该以哪种方式同步数据? - Android App make to work offline and online? Which way i should sync data? 如何在Android中显示没有数据库的脱机在线数据 - How to show online data for offline without database in Android 离线时如何存储数据mqtt以及在线时如何发送数据 - How to store data mqtt when offline and send them when online 如何使用脱机模式在mysql和android应用之间同步数据 - How to sync data between mysql and android app for offline mode using
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM