I am trying to write a BroadcastReceiver that listens to events like insert, edit, delete to the native android calendar (ICS and above). So whenever one of these events occur the app should be able to at the least know that these events occurred.
Any one has an idea, how to do this or any reference links.
I have written my own broadcasterReceiver class that extends from BroadcastReceiver. Can't figure out the values in the manifest like, currently I have this which is not working:
<receiver
android:name=".NativeEventChangeReceiver">
<intent-filter>
<action android:name="android.intent.action.EDIT"/>
<action android:name="android.intent.action.INSERT"/>
<action android:name="android.intent.action.DELETE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="vnd.android.cursor.dir/event"/>
</intent-filter>
</receiver>
Cheers,
Edit 1: Does anyone know a proper string for the data tag?, I think this is also required in the intent-filter.
Edit 2: Any hints about working with ContentObserver?
Finally found the solution after a lot of reading, this may help other finding a similar solution.
In the Manifest, you need to write these lines to be able to capture the changes:
<receiver
android:name=".NativeEventChangeReceiver">
<intent-filter>
<action android:name="android.intent.action.PROVIDER_CHANGED"/>
<data android:scheme="content"/>
<data android:host="com.android.calendar"/>
</intent-filter>
</receiver>
Cheers,