I am working with a local calendar. Here is my code to create an event:
ContentValues values = new ContentValues();
values.put(CalendarContract.Events.DTSTART, 1457926200000L);
values.put(CalendarContract.Events.DURATION, "P3600S");
values.put(CalendarContract.Events.RRULE, "FREQ=DAILY;COUNT=2;WKST=SU");
values.put(CalendarContract.Events.EVENT_TIMEZONE, TimeZone.getDefault().getID());
values.put(CalendarContract.Events.CALENDAR_ID, 34);
values.put(CalendarContract.Events.EXDATE, "20160314T033000Z");
values.put(CalendarContract.Events.TITLE, "R0");
Uri uri = getContentResolver().insert(CalendarContract.Events.CONTENT_URI, values);
Event is inserted correctly and while the COUNT
is 2 in RRULE
, I see just one event because of ExDate
. But if I remove this line:
values.put(CalendarContract.Events.EXDATE, "20160314T033000Z");
And update the inserted event:
ContentValues values = new ContentValues();
values.put(CalendarContract.Events.EXDATE, "20160314T033000Z");
int update = getContentResolver().update(ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, 3612), values, null, null);
Event is updated successfully (I query that and ExDate is updated correctly). However I see 2 events instead of one and it seems that ExDate
is not working.
I know that it is possible to insert exception using original_id
and original_instance_time
and CONTENT_EXCEPTION_URI
. I want to know is there any other way to do that instead of inserting another event?
Thanks