07-10-2013 03:23 PM
I am having some crazy trouble with the BB10 calendar for about 2-3 days now. I have tried ALL kinds of things but have run out of things to try.
I can insert a Calendar event via context.getContentResolver().insert(eventsUri, eventValues).
I can get the ID of the newly-inserted event via lastInsertId = Long.parseLong(eventUri.getLastPathSegment());
So far so good. Now, I know VIEW intents are *not* allowed (for bringing up the event in the calendar app) (http://developer.blackberry.com/android/apisupport
I go to the event's Month but to my surprise there are NO EVENTS for that month, despite me getting a new "ID" for each event that I attempted to insert.
I can't really pin-point the how or why, but after some time (couple of hours usually or ... have no idea!!) *THE EVENT SHOWS UP*, except I'm not sure what caused it to show up and which event it is (because I have tried multiple attempts to add the calendar event). Then there is a case where multiple of such events show up in the same day (due to many attempts to insert).
I AM BAFFLED!!! WTF?! The event I *just* added does not show up in the Calendar but I can get an event ID. For some strange reason, events decide to show up after some hours. WHAT IS GOING ON!?!
To help figure out why the events do not show up, I decided to query the calendar for that event.
You guessed it, 0 results, 0 row count, nothing shows up.
I use this code as a proof of concept:
Uri queryCalendar = Uri.parse("content://com.android.calendar/events")
Cursor cursor = getContentResolver().query(queryCalendar, null, null, null, null);
On Android, this code brings up ALL (ALL) calendar events.
On BB10, that code does JACK SQUAT!
PLEASE HELP, I cannot stress any more on this stupid implementation of Calendar. I have tried all kinds of URI's to fetch events, *including native BB10 URIs* that are supposed to run inside a native app, but NOTHING works.
I'd really really appreciate your help in figuring this out.
Solved! Go to Solution.
07-15-2013 11:24 AM
Programmatically inserting Calendar events via Android code is not supported.
We do support invoking the native Calendar app to allow the user to enter event details though.
Though I am working to put up a sample, here's a quick snippet:
final Intent calendarIntent = new Intent("android.intent.action.EDIT"); calendarIntent.addCategory("android.intent.categor
y.DEFAULT"); calendarIntent.setType("vnd.android.cursor.item/ev ent"); startActivity(calendarIntent);
07-15-2013 08:29 PM
Thank you for your reply Justin!
I definitely got the calendar app to show up with a title, description, location, start time and end time.
There is another field RRULE that calendars use to define the repetition and frequency of the event. This field is parsed just fine when passed -like the code below- in other platforms, but it's not showing up on this android-port.
final Intent calendarIntent = new Intent("android.intent.action.EDIT");
Would you have any code that either works, gets around it not working or maybe even an easter-egg hack I'll take to get this working!
07-19-2013 11:01 AM
07-19-2013 11:52 AM - edited 07-19-2013 11:54 AM
Thanks for your reply.
Hmm RRULE is a standard field when invoking calendars, and Android will accept it when firing a calendar intent.
I'm not quite sure how a JIRA web plugin would help, I don't think I get what you mean, but I'd like to file whatever is needed to get this to work (even though there would most likely have to be an update to BB10 before seeing this change).
07-19-2013 11:54 AM
I mean to say if you can do it natively, we can probably easily hook it up in Android (since we use the native API ourselves to invoke the calendar card).
07-23-2013 11:58 AM
I believe it can be done natively, it's a pretty standard rule for ICS/VCS files. If it didn't then you'd never be able to set events that repeat natively on the BB10. I'll have to take a really long break from work while I wait for this patch, best excuse ever!
but on the other hand, here's a snipet from above which sets the event start and event end days.
I have tested on these devices:
Q10 OS version 10.1.0.1483 and 10.1.0.1720
Z10 OS version 10.1.0.1720
...and no luck. The date is always set to be today's date, current base time, floor to ceil.
Any idea about this one?
07-23-2013 12:09 PM - edited 07-23-2013 12:23 PM
I mean does the calendar add event card expose a way for me to tell it that it should be a repeating event, etc. I will have to look into this.
Also, our support for calendar in general is a tad shoddy (i.e. undocumented) on 10.1.
10.2 supports CalendarContext.EXTRA_EVENT_BEGIN_TIME / EXTRA_EVENT_END_TIME. 10.1 you can use "dtstart" and "dtend" (aka Events.DTSTART / DTEND, and it's String data). We still support dtstart / dtend in 10.2 but if you set both we will use EXTRA_EVENT_BEGIN_TIME / EXTRA_EVENT_END_TIME (the proper, documented way to do this).
EDIT: i.e. http://developer.blackberry.com/html5/apis/blackbe
EDIT2: ^^^ those links should give you an idea of how to format the date if you use dtstart / dtend.
07-23-2013 03:59 PM
Thank you bbenninger for your reply.
I have tried your recommendation, checked out the links, tried to put the RRULE into the "start" and "startTime" fields, as well as "dtstart" and "dtend" as well as "beginTime" and "endTime" in the intent for starting the calendar app but no luck, start and end date time are set for now and no frequency
I think it's a waiting game for me at this point.
Thanks for your help,