Dev
Dev

Reputation: 122

Android Custom recurring events in calendar

I have gone through some of the links and i got to know how to insert an event to the calendar App of Android (rather than creating my own calendar). Now, I need to create a event which repeats every Tuesday and Thursday but I don't have the option of selecting such a choice. So how can I do that programmatically?

Any help would be greatly appreciated.

Upvotes: 0

Views: 2117

Answers (1)

Draghon
Draghon

Reputation: 367

Using Android 4.0:

New Event: Hanging out at Stack Overflow Tuesdays and Thursdays in April 2012 between 8:30-9:30am.

Intent intent = new Intent(Intent.ACTION_INSERT)
    .setData(Events.CONTENT_URI)
    .putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, 1333456200000L)
    .putExtra(CalendarContract.EXTRA_EVENT_END_TIME, 1333459800000L)
    .putExtra(Events.TITLE, "Hanging out at Stack Overflow")
    .putExtra(Events.RRULE, "FREQ=DAILY;BYDAY=TU,TH;UNTIL=20120430T083000Z")
    .putExtra(Events.RDATE, 1335792600000L)
    .putExtra(Events.AVAILABILITY, Events.AVAILABILITY_BUSY);
startActivity(intent);

Sources:
http://developer.android.com/guide/topics/providers/calendar-provider.html
https://www.rfc-editor.org/rfc/rfc5545

Upvotes: 2

Related Questions