将离线SQLite数据库与在线MySQL数据库同步 [英] Synchronize offline SQLite database with online MySQL database
问题描述
我正在创建一个Android应用程序,将数据存储在在线后端 MySQL 中,并将其存储在应用程序 sqllite
中.这意味着当用户在线时,数据将与在线后端数据库同步到sqlite数据库.当用户离线时,他/她可以使用sqlite数据.这是正确的方法吗?还是我可以做些更好的解决方案?
I'm creating a Android application that store the data in online backend MySQL and store it in app sqllite
. Which means when user is online, data sync with online backend database to sqlite database. When user offline, so he/she can use the sqlite data.is this proper way? Or what I can do to better solution ?
推荐答案
您应该使用同步适配器.
You should be using Sync Adapters.
在以下链接中查看其工作原理,并在文档中进一步了解更多信息.
Checkout how it works in the following link and go further on the documentation for more info.
https://developer.android.com/training/sync-adapters/index.html
这篇关于将离线SQLite数据库与在线MySQL数据库同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!