gpt4 book ai didi

android - 算法数据同步(SQLite到在线数据库)

转载 作者:太空狗 更新时间:2023-10-29 14:27:43 25 4
gpt4 key购买 nike

我正在创建一个与在线服务器同步数据的应用程序。什么是最好的方法?

我想拥有一个本地数据库 (SQLite),它将与具有相同结构的在线数据库同步。在线 XML 还是在线数据库更好?

其他问题。有没有已知的数据同步算法?

最佳答案

最佳做法是使用内容提供程序为您的应用程序建模,然后连接一个示例同步适配器。 http://developer.android.com/resources/samples/NotePad/index.html http://developer.android.com/resources/samples/SampleSyncAdapter/index.html

您可以在 Android SDK 中找到这些示例。在 Eclipse 中,

File >
New >
Android Project >
Create project from existing sample >
Android 2.1 >
Select desired project

(一旦您接触到平板电脑和 Android 4.0,情况就会开始发生变化,因此 7 或 8 是您最好的选择。)

下面的博文很好地解释了同步适配器。 http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-1/

如果您想快速开始,解析您的 XML,然后围绕它包装您的 SQLite 实现,请使用以下链接。 http://andrewgertig.com/2010/07/android-and-ruby-on-rails/

关于android - 算法数据同步(SQLite到在线数据库),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10375020/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com