Search code examples
androidandroid-calendarandroid-broadcast

Getting event data from Calendar Broadcast Receiver intent



I am trying to work with Android Calendar API, and have some problems. I created a broadcast receiver, and added intent filter into manifest like this:

<receiver android:name="com.project.receivers.CalendarEventReceiver">
   <intent-filter>
      <action android:name="android.intent.action.PROVIDER_CHANGED" />
         <data android:scheme="content"/>
         <data android:host="com.android.calendar"/>
   </intent-filter>     
</receiver>  

So, I can succesfully intercept events in onReceive(Context context, Intent intent) method in my BroadcastReceiver, BUT! - how should I parse this intent, how can I get information about calendar event from this intent without querying calendar content provider? Is it possible at all?

Thanks in advance!


Solution

  • If you print out the contents of the Intent, you will see that the intent does not carry any extra data. Thus, there is no meta data provided with the change in the calendar provider. I am assuming that you are hoping to know the event id, instance id and action (insert/update/delete) of the change.