1

I am trying a calender event & a reminder before that event from my app.

I refereed to this question. I am trying to accomplish using 1st option of accepted answer (using intent).

Now is there any key (like "beginTime" etc) using which I can set reminder & reminder time (like before 1 hour or before 1 day) in the Intent ??

Community
  • 1
  • 1
hemu
  • 3,199
  • 3
  • 44
  • 66

1 Answers1

0

Your question is answered in the accepted answer you linked to under the second half of part two.

and add an event and a reminder this way:

// get calendar
Calendar cal = Calendar.getInstance();     
Uri EVENTS_URI = Uri.parse(getCalendarUriBase(this) + "events");
ContentResolver cr = getContentResolver();

// event insert
ContentValues values = new ContentValues();
values.put("calendar_id", 1);
values.put("title", "Reminder Title");
values.put("allDay", 0);
values.put("dtstart", cal.getTimeInMillis() + 11*60*1000); // event starts at 11 minutes from now
values.put("dtend", cal.getTimeInMillis()+60*60*1000); // ends 60 minutes from now
values.put("description", "Reminder description");
values.put("visibility", 0);
values.put("hasAlarm", 1);
Uri event = cr.insert(EVENTS_URI, values);

// reminder insert
Uri REMINDERS_URI = Uri.parse(getCalendarUriBase(this) + "reminders");
values = new ContentValues();
values.put( "event_id", Long.parseLong(event.getLastPathSegment()));
values.put( "method", 1 );
values.put( "minutes", 10 );
cr.insert( REMINDERS_URI, values );
  • 1
    This is part of 2nd Option `Get a reference to the calendar with this method`. Look at method `getCalendarUriBase()`..... – hemu Dec 19 '12 at 07:47