
As mentioned previously, the two part tutorial on c99.org is a great starting place for people wanting to write their own synchronization service for Android. The only problem is that, because it syncs to Contacts, it omits to tell you what to do to get your new service appearing under Settings -> Accounts -> "Data and Synchronization".
The answer is surprisingly simple, but also elusive. As the tutorial stated, you certainly need:
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="com.martineve.mendroid.data.mendeleycollectionsprovider"
android:accountType="com.martineve.mendroid.account"
android:supportsUploading="true"
android:userVisible="true"/>This on its own, however, is not necessarily enough. It turns out that the check Android performs to ascertain whether to display a sync item underneath the "Data and Synchronization" panel is a call to ContentResolver.getIsSyncable(account), which has to return a positive integer value. This means that, in certain cases (of which I remain unsure), you'll need to call:
ContentResolver.setIsSyncable(account, "com.martineve.mendroid.data.mendeleycollectionsprovider", 1);... probably on some form of application startup/install.
If you need further guidance on this, I'd suggest browsing through my work at the Mendeley for Android Google Code repository.
References
This reference list has been generated, in many cases, through an automated process and may therefore contain errors or incomplete metadata. It is provided purely as assistance for finding the items mentioned within this post.
- Mendeley for Android Google Code repository <http://code.google.com/p/mendeley-for-android/>
- ‘Writing an Android Sync Provider: Part 1’, Did You Win Yet? <http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-1/>
- ‘Writing an Android Sync Provider: Part 2’, Did You Win Yet? <http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-2/>
- Mendeley for Android Google Code repository. (n.d.). http://code.google.com/p/mendeley-for-android/
- Writing an Android Sync Provider: Part 1. (n.d.). Did You Win Yet?. http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-1/
- Writing an Android Sync Provider: Part 2. (n.d.). Did You Win Yet?. http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-2/
- Mendeley for Android Google Code repository. n.d.. http://code.google.com/p/mendeley-for-android/
- “Writing an Android Sync Provider: Part 1.” n.d.. Did You Win Yet?. http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-1/
- “Writing an Android Sync Provider: Part 2.” n.d.. Did You Win Yet?. http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-2/
Martin Paul Eve