문제

Can someone explain how to use EXDATE when adding event to android calendar? The documentation is pretty unclear about the format in which the EXDATE should be put. I tried many formats, these are some of them:

values.put(Events.EXDATE, "TZID=Europe/London:20130116T080000");
values.put(Events.EXDATE, "20130116T080000Z");
values.put(Events.EXDATE, "20130116T080000");
values.put(Events.EXDATE, "20130116");

but none of them works. Any idea how to make an event not appear on a particular date, if by the RRULE it should appear?

도움이 되었습니까?

해결책

The correct format is:

values.put(Events.EXDATE, "20130116T080000Z");

However you must ensure that it is in UTC time. I was having the same problem starting from PST, so I just had to add 8 hours to get it to work.

다른 팁

In addition to the @kee23's answer, the next variant is valid for multiple EXDATE values:

contentValues.put(CalendarContract.Events.EXDATE, "20130116T080000Z,20130118T080000Z");

I'm adding on top of @kee23's excellent and correct answer:

I just got aware that in android, you can not persist EXDATEs to an event with endless recurrences, say RRULE:FREQ=DAILY. You need to limit the occurrences, as in RRULE:FREQ=DAILY;COUNT=600.

This is not documented by google and there is no error message if you try to persist endless recurrences with EXDATEs. It just silently dropped RRULE and DURATION in my case.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top