0

所以,我尝试基于我的内容提供者和服务器的 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>
4

1 回答 1

1

包名称不会自动添加到android:authorities.

所以,要么

  • 更改android:authorities=".model.db.opuscontentprovider"android:authorities="com.opussync.model.db.opuscontentprovider"
  • 在代码中用作content://.model.db.opuscontentprovider内容提供者的基本 URL。
于 2011-04-22T09:47:26.580 回答