一个人如何监听来自Android的SyncAdapter进展如何? [英] How does one listen for progress from Android SyncAdapter?

查看:136
本文介绍了一个人如何监听来自Android的SyncAdapter进展如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我记得阅读有关广播接收器接口的同步适配器或同步的一些ResultReceiver progress事件。是不是有什么内置在SyncAdapter模式或者是土生土长的?

I recall reading about a broadcast receiver interface from the sync adapter or some ResultReceiver of sync progress events. Is there something built into the SyncAdapter pattern or is it home-grown?

推荐答案

什么工作:

该方法在2010年的谷歌IO会议上提出,的开发的Andr​​oid REST客户端应用程序是把列到您的ContentProvider作为标记,以指示记录正被取出或放置或等。这允许每个行纺丝器(或其他视觉上的变化),以放置在你的用户界面。你可以做到这一点通过自定义的CursorAdapter驱动一个ListView。您的ContentProvider是勾上根据需要进行标志更改。

The method suggested in a 2010 Google IO session, Developing Android REST client applications is to place columns into your ContentProvider as tags to indicate that a record is being fetched or placed or etc. This allows a per-row spinner (or other visual change) to be placed in your UI. You might do that through a custom CursorAdapter that drives a ListView. Your ContentProvider is on the hook to make the flags change as needed.

有什么不:

您也可以使用<一个href="http://developer.android.com/reference/android/content/ContentResolver.html#addStatusChangeListener%28int,%20android.content.SyncStatusObserver%29"相对=nofollow> SyncStatusObserver - 这是pretty的无用,因为它响应状态的每一个变化,不只是你的特定帐户/ contentauthority对,真的不能告诉你任何东西都除此之外,变化发生。所以,你不能告诉正在同步,并且无法从同步活动结束区分开始同步事件。一文不值。 :P

You can also use a SyncStatusObserver -- Which is pretty much useless since it responds to every change of status, not just your specific account/contentauthority pair, and really doesn't tell you much anything at all other than that a change occured. So, you can't tell what is being synced, and you can't distinguish "start of sync event" from "end of sync event". Worthless. :P

这篇关于一个人如何监听来自Android的SyncAdapter进展如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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