Martin Paul Eve bio photo

Martin Paul Eve

Professor of Literature, Technology and Publishing at Birkbeck, University of London

Email Books Twitter Google+ Github Stackoverflow MLA CORE Institutional Repo Hypothes.is ORCID ID   ORCID iD

Email Updates

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.