i am inserting events in my android calendar. the code is following:
ContentValues event = new ContentValues();
event.put("calendar_id", calId);
event.put("title", "Event Title");
event.put("description", "Event Desc");
event.put("eventLocation", "Event Location");
event.put("allDay", 1);
event.put("eventStatus", 1);
event.put("visibility", 0);
event.put("transparency", 0);
event.put("hasAlarm", 1);
Date d = new Date();
d.setHours(8);
d.setMinutes(30);
d.setSeconds(30);
long startTime = d.getTime();
d.setHours(12);
d.setMinutes(30);
d.setSeconds(20);
long endTime = d.getTime();
event.put("dtstart", startTime);
// event.put("dtend", endTime);
event.put("rrule", "FREQ=DAILY;WKST=SU");
// event.put("lastDate", endTime);
// event.put("timezone", "Asia/Karachi");
//event.put("duration", "P3600S");
//Calendar gmtC = new GregorianCalendar(TimeZone.getTimeZone("Asia/Karachi"));
// event.put("transparency", 0);
// event.put("hasAlarm", 1); // 0 for false, 1 for true
Uri eventsUri = Uri.parse("content://calendar/events");
Uri url = getContentResolver().insert(eventsUri, event);
i am getting the following exception:
java.lang.IllegalArgumentException: allDay is true but sec, min, hour are not 0.
need help!