Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable synchronization of custom account in android?

I am writing my own SyncAdapter for android devices that should synchronize TV broadcast information to the device but ran into problem of not getting the Synchronize "mydata" checkbox visible under Data & Synchronization part of the account preferences.

I have implemented my own SyncAdapter and defined it properly in the xml:

Here is my sync.xml:

<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
    android:contentAuthority="com.example.tv.programs"
    android:accountType="com.example.tv.sync"
    android:supportsUploading="false"
    android:userVisible="true"
/>

Corresponding part of android manifest, where I define my sync service and provider:

<service android:name=".sync.ProgramSynchronizationService" android:exported="true" android:process=":programs">
    <intent-filter>
        <action android:name="android.content.SyncAdapter" />
    </intent-filter>
    <meta-data
        android:name="android.content.SyncAdapter"
        android:resource="@xml/sync" />
</service>

<provider android:name="com.example.tv.providers.ProgramContentProvider" 
    android:authorities="com.example.tv.programs" />

Am I doing something wrong as I don't get anything visible under the Data & Synchronization part?

like image 952
plouh Avatar asked Jul 13 '10 15:07

plouh


1 Answers

In addition to your sync-adapter setup, you also need to call (perhaps at program start):

ContentResolver.setIsSyncable(account, "com.example.tv.programs", 1)
like image 140
Martin Eve Avatar answered Oct 05 '22 21:10

Martin Eve