I can't find a way to insert exception dates to a recurring event.
Context
I'm parsing an .ics file (ical format) with an event with success. Here is the .ics
BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:TESTING
X-WR-TIMEZONE:Europe/Amsterdam
X-WR-CALDESC:
BEGIN:VTIMEZONE
TZID:Europe/Amsterdam
X-LIC-LOCATION:Europe/Amsterdam
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTART;TZID=Europe/Amsterdam:20140425T103000
DTEND;TZID=Europe/Amsterdam:20140425T113000
RRULE:FREQ=WEEKLY;BYDAY=FR
EXDATE;TZID=Europe/Amsterdam:20140516T103000
EXDATE;TZID=Europe/Amsterdam:20140502T103000
DTSTAMP:20140425T090449Z
UID:3bb37doi3qcuaih3t03ns0q9jo@google.com
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;CN=TESTIN
G;X-NUM-GUESTS=0:mailto:domain.com_o300s@group.calendar.google.com
CREATED:20140425T090310Z
DESCRIPTION:
LAST-MODIFIED:20140425T090427Z
LOCATION:
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:my-recurring-event-with-ex
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR
The event is then inserted into the Android calendar via the CalendarContract API.
dtstart: 20140425T103000 dtend: 20140425T113000 rrule: FREQ=WEEKLY;BYDAY=FR
Problem: exclusion date(s)
If I now query my calendar I will see an event on every friday starting on the 25 april 2014.
The problem is that I also need to exclude some dates (See ical: 2 may 2014 & 16 may 2014)
Attempt 1
I tried inserting the exdate for the 16 may only using the EXDATE field like this: android: EXDATE format when adding a calendar event But that didn't work and based on the android calendar source code it is not even used.
Attempt 2
I tried to insert the exception using the CONTENT_EXCEPTION_URI Via this so post: Make exception event from original recurring event? Google calendar code: https://github.com/android/platform_packages_apps_calendar/blob/master/src/com/android/calendar/EventInfoFragment.java#L1401
ContentValues values2 = new ContentValues();
values2.put(CalendarContract.Events.ORIGINAL_INSTANCE_TIME, event.getAsString(CalendarContract.Events.DTSTART));
values2.put(CalendarContract.Events.STATUS, CalendarContract.Events.STATUS_CANCELED);
Uri.Builder eventUriBuilder = CalendarContract.Events.CONTENT_EXCEPTION_URI.buildUpon();
eventUriBuilder.appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER, "true");
eventUriBuilder.appendQueryParameter(CalendarContract.Calendars.ACCOUNT_NAME, accountName);
eventUriBuilder.appendQueryParameter(CalendarContract.Calendars.ACCOUNT_TYPE, accountType);
ContentUris.appendId(eventUriBuilder, dbId);
Uri uriex = cr.insert(eventUriBuilder.build(), values2);
uriex is always null.
Attempt 3
I tried inserting a new event with a link to its original event like in the google calendar code for deleting a single entry of a recurring event https://github.com/android/platform_packages_apps_calendar/blob/master/src/com/android/calendar/DeleteEventHelper.java#L361
Q
Does anybody knows how to deal with the CalendarContract API for exceptions in a recurring event?