Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 101
Registered: ‎12-02-2012
My Device: Z10 LE, PlayBook 32GB
My Carrier: Beeline
Accepted Solution

Opening event in Calendar

Hi.

I'm trying to invoke calendar app with event spicified, but have no luck.

Here is my code:


void MyClass::invokeCalendar(int calendarAccountId, int eventId, QString eventDate)
{
    QVariantMap map;
    map["accountId"] = calendarAccountId; //1 - default
    map["eventId"] = eventId;
    map["start"] = eventDate;    // in form "2012-05-25 11:30:00"
    bool ok;
    QByteArray requestData = bb::PpsObject::encode(map, &ok);
    bb::system::InvokeManager* invokeManager = new bb::system::InvokeManager();
    bb::system::InvokeRequest cardRequest;
    cardRequest.setTarget("sys.pim.calendar");
    // cardRequest.setTarget("sys.pim.calendar.viewer.nav");
    cardRequest.setAction("bb.calendar.VIEW");
    // cardRequest.setAction("bb.calendar.OPEN");
    cardRequest.setData(requestData);
    cardRequest.setMimeType("text/calendar");
    invokeManager->invoke(cardRequest);
}

 I've also tried another variants (commented ones) - but have no luck either.

Calendar app successfully opens but not positioned on an event or date.

Am I doing something wrong?



My BB10 apps: Photo Memo | TriQuick | SkidStone | MeeBirthdays
If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post.
Highlighted
Developer
Posts: 101
Registered: ‎12-02-2012
My Device: Z10 LE, PlayBook 32GB
My Carrier: Beeline

Re: Opening event in Calendar

 Partially solved after intensive experiments. This code works for me:

void MyClass::invokeCalendar(int calendarAccountId, int eventId, QString eventDate)
{
    bb::system::InvokeManager* invokeManager = new bb::system::InvokeManager();
    bb::system::InvokeRequest cardRequest;
    cardRequest.setTarget("sys.pim.calendar");
    cardRequest.setAction("bb.calendar.VIEW");
    QUrl url;
    url.addQueryItem("accountId", QString::number(calendarAccountId));
    url.addQueryItem("eventId", QString::number(eventId));
    url.addQueryItem("startTime", eventDate); //NOTE (!): in documentation "query name" must be "date" - but it's not work
			//NOTE (!): I'm using "startTime" in format "2012-05-22 13:00:00"
    cardRequest.setData(url.toEncoded());
    cardRequest.setMimeType("text/calendar");
    invokeManager->invoke(cardRequest);
}

 Still can't make it work with sys.pim.calendar.viewer.nav example...



My BB10 apps: Photo Memo | TriQuick | SkidStone | MeeBirthdays
If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post.