Search code examples
c++browserblackberryheadless

How to open browser from headless app in blackberry


I'm trying to use notification, when the user click ok it should open the browser. This is the code I'm i using:

 bb::system::InvokeRequest request;
  request.setTarget("sys.browser");
  request.setAction("bb.action.OPEN");
  request.setUrl(QUrl("http://www.blackberry.com"));

NotificationDialog* notification = new NotificationDialog();

notification->setTitle(" Notification");
notification->setBody("click open to continue ...");

notification->appendButton(new bb::system::SystemUiButton("Open"), request);
notification->appendButton(new bb::system::SystemUiButton("Dismiss"));
notification->setParent(this);
notification->show();

The code doesn't work, though. What am I doing wrong and how is this done properly?


Solution

  • I found the answer.

    Replace this line >> request.setUrl(QUrl("http://www.blackberry.com")); by this line >> request.setUri("http://www.blackberry.com"));

    also don't forget to add LIBS += -lbbsystem to "yourProject".pro file.