将离线 SQLite 数据库与在线 MySQL 数据库同步 [英] Synchronize offline SQLite database with online MySQL database

查看:79
本文介绍了将离线 SQLite 数据库与在线 MySQL 数据库同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆