2010-07-13 3 views
5

TV 방송 정보를 기기와 동기화해야하지만 내 계정 설정의 데이터 & 동기화 부분에 "mydata 동기화"확인란이 표시되지 않는 문제에 부딪친 안드로이드 기기 용 자체 SyncAdapter를 작성 중입니다.android에서 맞춤 계정을 동기화하는 방법

난 내 자신의 SyncAdapter를 구현하고 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" 
/> 

해당 부분 내 동기화 서비스 제공을 정의 : 여기

내 sync.xml입니다 : 나는 데이터 & 동기화 부분에서 볼 수 아무것도하지 않는 뭔가 잘못하고

<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" /> 

건가요? 동기화 어댑터 설정 외에도

답변

10

, 당신은 또한 (아마도 프로그램 시작시)를 호출해야합니다 당신이 자동으로 당신이 할 수있는 동기화를 활성화하려면

ContentResolver.setIsSyncable(account, "com.example.tv.programs", 1) 
3

는이에 추가하려면

ContentResolver.setSyncAutomatically(account, "com.example.tv.programs",true); 
+0

Android 설명서에 따르면 이렇게하면 몇 초마다 동기화됩니다. 제발 질문에 대답 할 수 : http://stackoverflow.com/questions/22206596/how-to-enable-sync-without-syncing-every-few-seconds? – cja

관련 문제