Sergio Viudes
Sergio Viudes

Reputation: 2854

Capture calendar changes in Android 2.2+

I'm developing a calendar widget that shows calendar events. I need to capture when the user adds/modify/delete events from the calendar app, to refresh my widget. I used a broadcast receiver with this filter:

    <intent-filter>
        <action android:name="android.intent.action.PROVIDER_CHANGED" />

        <data android:scheme="content" />
        <data android:host="com.android.calendar" />
    </intent-filter>

I tested it with Android 4.2 (with a Nexus 4) and works ok. But I tested it with Android 2.3.7, and isn't working. There is any way to get it working in Android versions >= 2.2?

Thanks

Upvotes: 0

Views: 211

Answers (2)

Sergio Viudes
Sergio Viudes

Reputation: 2854

Seems that I solved it using a ContentObserver inside a service. It works as I needed! :)

Upvotes: 0

ianhanniballake
ianhanniballake

Reputation: 199880

There is no public API for calendar events prior to Android v14 (Ice Cream Sandwich). Prior to that, each manufacturer had to provide their own Calendar API and implementations, some of which do not provide the appropriate broadcasts upon changes.

Upvotes: 1

Related Questions