Android SyncAdapter与CalendarProvider

Android SyncAdapter与CalendarProvider,android,calendar,android-syncadapter,Android,Calendar,Android Syncadapter,我一直在努力实现一个自定义同步适配器,现在收到一个错误,上面写着“找不到…的提供商信息” 在四处搜索之后,我似乎需要提供一个ContentProvider,但我能找到的所有示例都涉及一个自定义ContentProvider。例如下面的例子: <provider android:name=".provider.FeedProvider" android:authorities="com.example.android.network.sync.basicsyncadapter

我一直在努力实现一个自定义同步适配器,现在收到一个错误,上面写着“找不到…的提供商信息”

在四处搜索之后,我似乎需要提供一个ContentProvider,但我能找到的所有示例都涉及一个自定义ContentProvider。例如下面的例子:

<provider
    android:name=".provider.FeedProvider"
    android:authorities="com.example.android.network.sync.basicsyncadapter"
    android:exported="false" />

但是,我的应用程序会同步日历数据,因此我想使用作为我的内容提供商

最终目标是在同步时从服务器接收数据,并在接收到该数据时相应地更新日历

这实际上是可能的,还是我必须实现自己的虚拟ContentProvider


如果可能的话,有没有关于如何做到这一点的例子?

在查看了一些关于如何使用ContactProvider同步联系人的例子后,我已经能够解决我自己的问题,ContactProvider似乎比CalendarProvider记录得更详细

可以找到给我答案的博客帖子

我从AndroidManifest.xml中删除了提供程序,并在syncadapter.xml文件中将contentAuthority设置为com.android.calendar

<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
              android:accountType="com.example.calendardemo"
              android:allowParallelSyncs="false"
              android:contentAuthority="com.android.calendar"
              android:isAlwaysSyncable="true"
              android:supportsUploading="true"
              android:userVisible="true"/>