我尝试了解 Android 同步逻辑。我不明白的是syncadapter.xml
Android SDK 示例项目中包含的文件SampleSyncAdapter
。如果您下载了 SDK 示例,它应该位于以下文件夹中:
SDK/android-sdk-PLATFORM/samples/android-VERSION/SampleSyncAdapter/res/xml/syncadapter.xml
我读到,内容提供者的权限应该是一个字符串或对资源的引用。内容权威到底是什么,在哪里com.android.contacts
?这是文件的内容(无许可证信息和注释,API 级别 16)。
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="com.android.contacts"
android:accountType="com.example.android.samplesync"
android:supportsUploading="false"
android:userVisible="true"
/>