2

android 应用程序在离线模式下将数据存储在 SQLite 数据库中。在线时,我希望应用程序与云服务器(App Engine)中的数据存储(数据库)同步(双向)。如何实现此功能,以便可以在 Web 应用程序上显示手机上捕获的数据。如果有的话,也请建议任何简单的替代方法。

4

2 回答 2

2

我只是把我的数据写成一个字符串(使用一种我可以重建我的数据的格式),将它传递给 AE,解析它并存储/显示它。

你也可以使用json。

或尝试http://mylifewithandroid.blogspot.jp/2010/10/client-server-communication-with-json.html

对于同步部分,我使用时间戳。如果时间戳结果没有记录在服务器上,我会记录下来。我将记录的邮票发回给客户并从商店中删除。当然,如果用户的记录是从不同的客户端更新的,服务器也可以发回新的结果。

于 2012-08-05T01:24:13.673 回答
0

In general, you should implement some complex algorithm, that will be doing synchronization depending on your needs, and then make it in code on both side (server and client). This not quite a simple task, in general. Useful keywords for googling: SOAP, REST, JSON, ...

于 2012-08-05T01:45:43.883 回答