I have my own ContentProvider and SyncAdapter which both work fine.
I set them to be automatically synced with ContentResolver.setSyncAutomatically() an this work. I can also test the sync with Dev Tools -> Sync Tester.
Now I would like to request a sync from my app (if we have no data yet) and be notified when it finishes, so I can updated the interface (I’m showing a progress bar with logo while it’s syncing). I’m doing this with ContentResolver.requestSync(), but I have not found a way to get notified when the sync finishes.
Does anyone know how to do this? Thanks.
Using
addStatusChangeListener()will give you callbacks when the sync isSYNC_OBSERVER_TYPE_ACTIVEorSYNC_OBSERVER_TYPE_PENDING. It is well weird that there is no finished event.Here is a workaround suggested by Felix. He suggests that you should ditch the
ContentResolverin favour of Broadcasts.