Published January 14, 2011 | https://doi.org/10.59348/9jxvd-6t191

Getting a custom Sync Service and Adapter to show up under "Data and Synchronization" on Android

Creators & Contributors

Androids!

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.

Getting a custom Sync Service and Adapter to show up under "Data and Synchronization" on Android was originally published by Martin Paul Eve at eve.gd: Martin Paul Eve on January 14, 2011.

Files

10.59348_9jxvd-6t191.pdf

Files (111.0 kB)

Name Size Download all
md5:bcc8a3c3a9d8f26654acb7330d406acf
111.0 kB Preview Download

Additional details

Description

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.

Dates

Issued
2011-01-14T00:00:00Z
Updated
2011-01-14T07:14:08Z