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

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
greenmr
Posts: 911
Registered: ‎03-20-2013
My Device: Red LE Developer Z10

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.
Developer
calicratis19
Posts: 163
Registered: ‎12-06-2012
My Device: Z10, Q10

Re: Can't invoke the clock app

I have tested on 10.1 too. Still same problem :smileysad:

BlackBerry Development Advisor
sabdelsayed
Posts: 249
Registered: ‎08-17-2012
My Device: BlackBerry Z10 and Q10

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
greenmr
Posts: 911
Registered: ‎03-20-2013
My Device: Red LE Developer Z10

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.
BlackBerry Development Advisor
sabdelsayed
Posts: 249
Registered: ‎08-17-2012
My Device: BlackBerry Z10 and Q10

Re: Can't invoke the clock app

Good catch greenmr, code updated :smileyhappy:

@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