简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM