Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to signal sync-complete to the Android SyncManager?

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.

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.

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.

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

What am I missing?

like image 584
mobibob Avatar asked Apr 26 '11 03:04

mobibob


1 Answers

To elaborate on shunty's answer with an example:

Here is an example of setting the SyncResult. I just use it to set the number of exceptions in the stats field. The result I see then is that an error icon is displayed for that sync item in the Accounts & sync screen.

like image 192
maxpower47 Avatar answered Sep 27 '22 20:09

maxpower47