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: 163
Registered: ‎12-06-2012
My Device: Z10, Q10
My Carrier: BlackBerry

Re: Can't invoke the clock app

Removed setting the target type. Same error again ...

 

    Invoker *request = new Invoker(this);
    request->setAction("bb.action.VIEW");
    request->setMimeType("text/plain");
    request->setTarget("bb.clock.launcher");
    request->setData("worldClockTab");
    request->invoke();

 

Developer
Posts: 1,065
Registered: ‎03-20-2013
My Device: Red LE Developer Z10
My Carrier: Fido

Re: Can't invoke the clock app

Well, you seem to setting the parameters correctly according to the documentation, and the error you are getting is identical to the one caused by the B10.2 InvokeQuery bug, so it really looks like BlackBerry borked more than just InvokeQuery invocation with 10.2. If you haven't already, try running your code in a 10.1 simulator and see if it runs as-is. If so, then clearly you are doing it right, and BB10.2 is at fault and you should log a JIRA report.



Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.  multiFEED Icon

Play nice: Clicking Like Button on posts that helped you not only encourages others to continue sharing their experience, but also improves your own rating on this board. Also, don't forget to accept a post if it solves your problem or answers your question.
Developer
Posts: 163
Registered: ‎12-06-2012
My Device: Z10, Q10
My Carrier: BlackBerry

Re: Can't invoke the clock app

I have tested on 10.1 too. Still same problem Smiley Sad

BlackBerry Development Advisor
Posts: 252
Registered: ‎08-17-2012
My Device: BlackBerry Z10 and Q10
My Carrier: Bell

Re: Can't invoke the clock app

[ Edited ]

Hi calicratis19,

 

I have tried the following code on the 10.2 SDK and have confirmed that the clock app invocation works correctly and as expected.

 

void ApplicationUI::invoke()
{
 //invoke Clock app
 bb::system::InvokeRequest request;
 request.setTarget("bb.clock.launcher");
 request.setAction("bb.action.VIEW");
 request.setMimeType("text/plain");
 request.setData("worldClockTab");

 bb::system::InvokeManager *invokeManager = new  bb::system::InvokeManager();

 invokeManager->invoke(request);

 bb::system::InvokeTargetReply *reply = invokeManager->invoke(request);
 if (reply)
 {
   reply->setParent(this);
   QObject::connect(reply, SIGNAL(finished()), this, SLOT(invokeFinished()));
 switch (reply->error())
 {
  case bb::system::InvokeReplyError::NoTarget:
       qDebug()<<"Target not found";
       break;
  case bb::system::InvokeReplyError::BadRequest:
       qDebug()<<"Bad request";
       break;
  case bb::system::InvokeReplyError::Internal:
       qDebug()<<"Internal error";
       break;
  default:
       qDebug()<<"No errors found, carried out successfully";
       break;
 } } else { qWarning() << "Invoke Failed! InvokeReply is empty."; } }

 

After running the code on my Z10, i get the following message in the console "

No errors found, carried out successfully" and the clock app is launched correctly in my app.

 

Hope that helps!

@SamarAbdelsayed

Did this answer your question? Please accept post as solution.
Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Developer
Posts: 1,065
Registered: ‎03-20-2013
My Device: Red LE Developer Z10
My Carrier: Fido

Re: Can't invoke the clock app

That's good, but your code will blow up if reply is NULL when it gets to the switch (reply->error()) code. Put the switch block inside the if(true) block, right after the QObject::connect.


sabdelsayed wrote:

Hi calicratis19,

 

I have tried the following code on the 10.2 SDK and have confirmed that the clock app invocation works correctly and as expected.

 

void ApplicationUI::invoke()
{
 //invoke Clock app
 bb::system::InvokeRequest request;
 request.setTarget("bb.clock.launcher");
 request.setAction("bb.action.VIEW");
 request.setMimeType("text/plain");
 request.setData("worldClockTab");

 bb::system::InvokeManager *invokeManager = new  bb::system::InvokeManager();

 invokeManager->invoke(request);

 bb::system::InvokeTargetReply *reply = invokeManager->invoke(request);
 if (reply)
 {
   reply->setParent(this);
   QObject::connect(reply, SIGNAL(finished()), this, SLOT(invokeFinished()));
 }
 else
 {
  qWarning() << "Invoke Failed! InvokeReply is empty.";
 }

 switch (reply->error())
 {
  case bb::system::InvokeReplyError::NoTarget:
       qDebug()<<"Target not found";
       break;
  case bb::system::InvokeReplyError::BadRequest:
       qDebug()<<"Bad request";
       break;
  case bb::system::InvokeReplyError::Internal:
       qDebug()<<"Internal error";
       break;
  default:
       qDebug()<<"No errors found, carried out successfully";
       break;
 }
}

 

After running the code on my Z10, i get the following message in the console "

No errors found, carried out successfully" and the clock app is launched correctly in my app.

 

Hope that helps!






Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.  multiFEED Icon

Play nice: Clicking Like Button on posts that helped you not only encourages others to continue sharing their experience, but also improves your own rating on this board. Also, don't forget to accept a post if it solves your problem or answers your question.
Highlighted
BlackBerry Development Advisor
Posts: 252
Registered: ‎08-17-2012
My Device: BlackBerry Z10 and Q10
My Carrier: Bell

Re: Can't invoke the clock app

Good catch greenmr, code updated Smiley Happy

@SamarAbdelsayed

Did this answer your question? Please accept post as solution.
Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Developer
Posts: 355
Registered: ‎04-08-2013
My Device: Z10
My Carrier: Virgin Canada

Re: Can't invoke the clock app

I know this thread is old and solved, but I just found out how to invoke Clock card. I'll share the code here as it's undocumented.

 

 //invoke Clock card
 bb::system::InvokeRequest request;
 request.setTarget("sys.clock.card");
 request.setData("worldClock");
 
 
The 4 possible values of Data are:
alarmClock
worldClock
stopwatch
timer
 
By the way, ain't the code shared in the solution is invoking the clock app twice? First time without an InvokeReply and second time with an InvokeReply... Just saying...