Page 1 of 1

Calendar event

Posted: 18 Jan 2013 00:42
by colabi
I try to create an event in calendar with this flow:
calendar_event.xml
(1.71 KiB) Downloaded 1137 times
but all i get is title of event modified;

putString("title", "123"); - this working
putLong("dtstart", {triggertime}); (Fri, 18 Ian 2013 > 20:00)
putLong("dtend", {triggertime}); - not working (Fri, 18 Ian 2013 > 20:30 - but i want to be 20:00)
putInt("calendar_id", 2); - not working (even if is set to 1,2,3... the implicit calendar is "phone" but i need google calendar)

thanks

Re: Calendar event

Posted: 18 Jan 2013 13:16
by Martin
Switching the calendar using an intent seems not to be supported (at least I did not find it in the documentation):
http://developer.android.com/guide/topi ... ml#intents
The second table lists the supported extras.

The EditEventActivity of the calendar app on my device defaults to the calender where the last event has been saved.

Following settings for action Start Activity worked for me (Android 4.2):
Action: android.intent.action.EDIT
Data MIME Type: vnd.android.cursor.item/event
Extras:
putString("title", "test");
putString("description", "abcd");
putString("eventLocation", "abcd");
putLong("beginTime", triggertime);
putLong("endTime", triggertime+3600000);//one hour in the future

You can also replace the variable triggertime with an expression:
putLong("endTime", addMinutes(triggertime, 30));//30 minutes in the future