如何将 Android 手机上的 SQLite 数据库与服务器上的 MySQL 数据库同步?

问题描述:

我正在开发一个安卓应用程序.我想用服务器上的 MySQL 数据库更新本地 SQLite 数据库.我无法弄清楚最合适和最标准化的方法是什么?

I am developing an android application. I want to update the local SQLite database with MySQL database on server. I am not able to figure out that what is the most appropriate and standardized way to do so?

创建一个 Web 服务(REST 可能是最好的)并序列化您的 SQLite/MySQL 数据,然后将其 PUT/POST/GET 到您的 Web 服务/从您的 Web 服务获取.如果您决定从 MySQL 切换到其他服务器端,这将为您提供一个很好的抽象层.

Create a webservice (REST is probably best) and serialize your SQLite/MySQL data and PUT/POST/GET it to/from your web service. This will give you a nice layer of abstraction in case you decide to switch from MySQL to something else server side.