Calendar event

Post your questions and help other users.

Moderator: Martin

Post Reply
colabi
Posts: 134
Joined: 06 Jan 2013 22:33

Calendar event

Post by colabi » 18 Jan 2013 00:42

I try to create an event in calendar with this flow:
calendar_event.xml
(1.71 KiB) Downloaded 1136 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

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Calendar event

Post by Martin » 18 Jan 2013 13:16

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

Post Reply