Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android SyncAdapter with CalendarProvider

I have been working on implementing a custom Sync Adapter and am now receiving an error which says "Failed to find provider info for ..."

After searching around it appears that I need to provide a ContentProvider but all the examples I can find involve a custom ContentProvider. Such as the example below:

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

However my app syncs Calendar data and therefore I want to use the Calendar Provider as my ContentProvider?

The end goal is to receive data from a server when synchronizing and update the calendar accordingly when this data is received.

Is this actually possible, or would I have to implement my own dummy ContentProvider?

If it is possible, are there any examples as to how this can be done?

like image 314
James Warner Avatar asked Feb 11 '26 06:02

James Warner


1 Answers

I've been able to solve my own problem after looking at some examples as to how Contacts are synced using the ContactProvider which seems to be more well documented than CalendarProvider.

The blog post which gave me the answer can be found here.

I removed the provider from my AndroidManifest.xml and in my syncadapter.xml file I set the contentAuthority to be 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"/>
like image 171
James Warner Avatar answered Feb 15 '26 00:02

James Warner