I'm trying to get a custom ContentProvider to show up under Data & synchronization, and I'm running into some problems. Namely, it's not showing up.
The specifics:
My AndroidManifest.xml has the provider and service:
<provider android:name="BooksProvider"
android:label="ClientName Books"
android:authorities="com.clientname.reader.books"
android:enabled="true"
android:exported="true"
android:syncable="true">
<grant-uri-permission android:pathPattern=".*" />
</provider>
<service android:name=".sync.SyncService"
android:exported="true" android:process=":sync">
<intent-filter>
<action android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data android:name="android.content.SyncAdapater"
android:resource="@xml/syncadapter" />
</service>
And res/xml/syncadapter.xml has the following:
<?xml version="1.0" encoding="utf-8"?>
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="com.clientname.reader.books"
android:accountType="com.google"
android:supportsUploading="true"
android:userVisible="true"
/>
Just to be safe, I've even called the following on onCreate:
AccountManager accountManager = AccountManager.get(getApplicationContext());
Account[] accounts = accountManager.getAccountsByType("com.google");
for(Account account : accounts){
Log.d(TAG, "Account: " + account.name);
ContentResolver.setIsSyncable(account, Reader.AUTHORITY, 1);
}
When I load up the Activity, I get adb logging from ContentResolver.setIsSyncable saying that account is already set to be syncable, so the method isn't doing anything.
And yet, the provider refuses to show up in Settings > Accounts & Sync > Data & synchronization. Any ideas on why? Anyone know how it's determined what appears in that section?
[edit] Some more information:
After spending hours debugging, I'm coming across this error:
04-11 10:46:02.370: DEBUG/SyncManager(105): can't find a sync adapter for SyncAdapterType Key {name=com.clientname.reader.books, type=com.google}, removing settings for it
It also appears my SyncService class is never actually getting called. Am I supposed to be invoking it myself? None of the samples I've seen or applications in the wild invoke it themselves, but they also all have auth components. Thoughts?