plo*_*ouh 5 account android synchronization
我正在为Android设备编写自己的SyncAdapter,它应该将电视广播信息同步到设备,但是遇到了在帐户首选项的数据和同步部分下没有看到Synchronize"mydata"复选框的问题.
我已经实现了自己的SyncAdapter并在xml中正确定义了它:
这是我的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"
/>
Run Code Online (Sandbox Code Playgroud)
android清单的相应部分,我定义了我的同步服务和提供者:
<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" />
Run Code Online (Sandbox Code Playgroud)
我做错了什么,因为我在数据和同步部分没有看到任何东西?
Mar*_*Eve 10
除了你的同步适配器设置,你还需要调用(可能在程序启动时):
ContentResolver.setIsSyncable(account, "com.example.tv.programs", 1)
Run Code Online (Sandbox Code Playgroud)