Sync Android contacts with server - syncing algorithm

admin

Administrator
Staff member
I want to sync my android device's contacts with a server (1-way syncing: update server according to the device's contacts DB).

I've seen the SampleSyncAdapter example:
<a href="http://developer.android.com/resources/samples/SampleSyncAdapter/index.html" rel="nofollow">http://developer.android.com/resources/samples/SampleSyncAdapter/index.html</a>

and a very good blog for understanding the pieces in the puzzle:
<a href="http://ericmiles.wordpress.com/2010/09/22/connecting-the-dots-with-android-syncadapter/" rel="nofollow">http://ericmiles.wordpress.com/2010/09/22/connecting-the-dots-with-android-syncadapter/</a>

I understand that the sync logic itself is supposed to be in overriding onPerformSync() in a class extending AbstractThreadedSyncAdapter.

I was not, however, able to find an example for the syncing algorithm.
For instance, how do I sync just the diffs from the previous sync? am I supposed to keep a cache for the latest synced contacts and diff it with the current contacts DB?