SyncAdapter替代品 [英] SyncAdapter alternatives

查看:391
本文介绍了SyncAdapter替代品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为它众所周知,在最坏记录的主题列表,SyncAdapter明媚如钻石般! acording到<一个href="http://udinic.word$p$pss.com/2013/07/24/write-your-own-android-sync-adapter/">http://udinic.word$p$pss.com/2013/07/24/write-your-own-android-sync-adapter/ SyncAdapter带来了4个主要的好处: A)电池效率 B)接口 C)内容意识的 D)重试机制;

I think its well known that in list of worst-documented topics, SyncAdapter shines bright like a diamond ! acording to http://udinic.wordpress.com/2013/07/24/write-your-own-android-sync-adapter/ SyncAdapter brings 4 main benefits : A) Battery efficiency B) Interface C) Content awareness D) Retry mechanism;

如果在任何情况下,有必要同步一个SQLite数据库与远程SQL数据库,和所有这些好处需要,还有什么其他的选择有没有**? **它易于管理服务之间的数据块用PHP,我这样做,对上传同步过程的一部分,但对于下载部分,我觉得很傻,如果我使用查询填写不久的将来,远程数据库的方法,原因可能得到大,这使我的心是我自己写的同步活动/服务,但我不知道如何访问上次更新日期的SQLite数据库/表(而不是在每一个表指定_date,),以larger.the唯一的解决办法检查是否有必要再次同步?我觉得我的头是两地之间!

if in any case there's a need to sync an sqlite DB with remote SQL DB, and none of these benefits is needed, what other alternatives are there**?** its easy to manage a service in-between the DBs with php, I did that for Uploading part of syncing process,but for the downloading part I feel silly if I use the query filling method,cause in near future remote db might get large and larger.the only solution that comes to my mind is to write my own sync activity/service, but I dont know how to access the last update date to SQLite db/table (other than specifying a _date in every table,) to check if it is necessary to sync again ? I feel my head is between two places!

推荐答案

正在混合的问题。 1 - 你真的必须使用同步适配器???所以,如果是的,你是要去有每桌一个同步调用,也没有需要保存的最后一次通话时间。 Android将为你做它。只需设置您的同步计时器正常 2 - 其他的解决办法是做一个简单的AsyncTask的,做你的工作在这里。 (对于为例,如果你必须这样做每周一次)

You are mixing the problem. 1- Do you really have to use sync Adapter ??? So if yes, you are gonna have a Sync call per table and no needs to save the last call date. Android will do it for you. Just setup your sync timers properly 2- other solution is to do a simple AsyncTask and do your job here. (For exemple if you have to do it only once per week)

有关您的日期问题,事情是,如果你真的想知道,如果你是由你得到了许多解决方案的日期。在您的服务器上保存日期,或者增加一个版本,当您从您的设备调用同步知道,如果你有同步或不进行比较。 另一个解决方法是简单地只是刷新你的数据库无论它被更新时(对于为例你有一个小的数据库,所以没有必要建立一个优化的系统)。

For your date problem, the thing is if you really wants to know if you are up to date you got many solutions. On your server save the date, or increment a version and compare these when you call a sync from your device to know if you have to sync or not. An other solution is to simply just refresh your db wherever it is updated or not(for exemple you got a small db, so no need to create an optimized system).

我面临同样的问题,几个月前,希望这有助于你。

I faced the same problem months ago and hoped this helped you.

这篇关于SyncAdapter替代品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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