05-17-2013 02:38 PM
Does anyone know how to create a calendar event using an intent? Blackberry has been touting its availability since December, see http://http://devblog.blackberry.com/2012/12/andro
Intent intent = new Intent(Intent.ACTION_INSERT); intent.setData(Events.CONTENT_URI); intent.putExtra(CalendarCompatibility.EXTRA_EVENT_
BEGIN_TIME, startMillis); intent.putExtra(CalendarCompatibility.EXTRA_EVENT_ END_TIME, endMillis); intent.putExtra(CalendarCompatibility.EXTRA_EVENT_ ALL_DAY, allDayEvent); mContext.startActivity(intent);
Thanks in advance,
Solved! Go to Solution.
05-21-2013 04:08 PM
Intent.ACTION_EDIT instead of Intent.ACTION_INSERT.
Looking at the Calendar app's manifest for Gingerbread, it doesn't handle the Intent.ACTION_INSERT. I'm not sure why.
05-21-2013 05:19 PM
It does not help using Intent.ACTION_EDIT
Intent.ACTION_INSERT was added in HoneyComb, therefore it's not in Gingerbread Android Calendar.
But we are talking about the Blackberry Native Calendar, and it is supposed to intercept an Intent, and show the native calendar.
So how do we do it?
05-21-2013 05:20 PM
The code that handles adding events to the native calendar mimics the intents you'd use to add to the android calendar. So you have to use the same intents you'd use in Gingerbread.
05-21-2013 05:53 PM
Well, the Gingerbread calendar officially didn't support creating events via intents...
Looking at the Android source code it is possible using the following;
Intent intent = new Intent(Intent.ACTION_EDIT); intent.setType("vnd.android.cursor.item/event"); intent.putExtra("beginTime", startMillis); intent.putExtra("endTime", endMillis); intent.putExtra("allDay", allDayEvent);
It works, but;
The beginTime & endTime are ignored!
Also, Subject & Location are prefilled with "null"
Can someone telll us what is the right way to do it in Blackberryy?
05-21-2013 06:10 PM - edited 05-21-2013 06:20 PM
This is the only way to do it for BlackBerry.
This is also poorly documented, we should probably fix this.
Use the following
"dtstart" for start time
"dtend" for end time
"title" for subject
"eventLocation" for location
(Specifically, android.provider.Calendar.Events START/STOP/TITLE/EVENT_LOCATION)
I'll look into getting this cleaned up a bit. We should add support for the officially supported way (in addition to keeping this).
05-22-2013 12:42 PM
Thank you for replying, but...
"title" & "eventLocation" work,
but "dtstart" & "dtend" do not!
I am passing to them milliseconds since epoch (as in android.provider.Calendar). Maybe you are supposed to pass something else?
Thanks in advance,
05-27-2013 05:18 PM - edited 05-27-2013 05:23 PM
dtstart / dtend are not in milliseconds, it's in date format (apparently). E.G 2013-05-27 ... (yyyy-MM-dd HH:mm:ss).
Going forward in 10.2 we'll properly support "beginTime" and "endTime" as a long extra.