如何信号同步完成到Android SyncManager? [英] How to signal sync-complete to the Android SyncManager?

查看:196
本文介绍了如何信号同步完成到Android SyncManager?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是从我的SyncAdapter内使用cancelRequest(),它退出它的线程之前,但后来我决定,只是打算用另一个实体(UI)的要取消正在进行的同步(时间太长,哎呀呀,等等。)

I was using cancelRequest() from within my SyncAdapter, just before it exits its thread, but I then decided that was only intended to be used by another entity (UI) that wants to cancel a sync in progress (taking too long, oops, etc.)

现在我同步认为总有一个待处理的请求 - 我用忽略新的请求

Now my sync thinks there is always a pending request - which I use to ignore new requests.

这是我所去的另一件事是在被监听更改为服务侦听器线程在 ContactsContract.AUTHORITY ,因此它可以揭开序幕我聚集的同步。

The other thing that I have going is a listener thread in a Service that is listening for changes to the ContactsContract.AUTHORITY so it can kick off a sync of my aggregation.

更新:这个监听线程泄漏。我发出.stop()时,我与它我做的,但是,有一个处理程序,我认为是活着,并从停止保持服务。

UPDATE: This listener thread is leaking. I am issuing a .stop() when I am done with it, however, there is a handler that I think is staying alive and keeping the service from stopping.

我想送SyncResults一些实体(即SyncManager)跟踪这样的事待处理,回收利用等。

I would like to send SyncResults to some entity (i.e., the SyncManager) that tracks such things for pending, recycle, etc.

我在想什么?

推荐答案

您可以使用的 SyncResult 此类用于通信的同步操作的SyncManager结果。基于这里的值SyncManager将决定同步的和是否一个新的同步操作需要安排在未来的处置

You can use the SyncResult This class is used to communicate the results of a sync operation to the SyncManager. Based on the values here the SyncManager will determine the disposition of the sync and whether or not a new sync operation needs to be scheduled in the future

这篇关于如何信号同步完成到Android SyncManager?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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