所以,我尝试基于我的内容提供者和服务器的 SyncAdapter 来实现同步。似乎一切都创建和初始化得很好,我可以在 Accounts&Sync 中看到我的帐户,还可以看到同步我的内容提供商的复选框。
但是我在 LogCat 中遇到了奇怪的错误:
错误/AccountSettings(130):提供者需要权限标签“com.opussync.model.db.opuscontentprovider”
但我肯定已经在清单中设置了这个标签!
这就是为什么我认为当我尝试检查我帐户的数据和同步中的同步复选框时,我会收到一条消息:
同步当前遇到问题。它很快就会回来
这是我的清单的主要部分:
<!-- CONTENT PROVIDER -->
<provider
android:name=".model.db.OpusContentProvider"
android:label="BLABLABLA"
android:authorities=".model.db.opuscontentprovider"
></provider>
<!-- SERVICES -->
<service android:name=".service.OpusAccountsSyncService" android:exported="true" android:process=":zencoosync">
<intent-filter >
<action android:name = "android.accounts.AccountAuthenticator"/>
</intent-filter>
<meta-data android:name="android.accounts.AccountAuthenticator"
android:resource="@xml/authenticator" />
</service>
<service
android:name=".model.syncadapter.SyncService"
android:exported="true"
android:syncable="true"
>
<intent-filter>
<action android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data
android:name="android.content.SyncAdapter"
android:resource="@xml/syncadapter" />
</service>