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: 59
Registered: ‎09-05-2013
My Device: Z10
My Carrier: *

WebView in a headless app

Hello, 

I am working with a headless and I want to use the WebView or WebPage class in it. When I use it I get the following error "undefined reference to `bb::cascades::WebPage::WebPage(QObject*)". I have included <bb/cascades/WebPage> class, can anyone help to resolve this issue. 

Retired
Posts: 85
Registered: ‎05-25-2012
My Device: Limited Edition Z10
My Carrier: Bell

Re: WebView in a headless app

Headless apps do not have a UI portion.  If you need to display something to a user via a webview, you need to have a separate app that your headless app communicates with.  For more information on Headless apps see:

 

https://developer.blackberry.com/native/documentation/cascades/device_platform/headless_apps/index.h...

 

And there are sample apps that show Inter-Process communication between UI and headless apps:

 

https://github.com/blackberry/Cascades-Samples/tree/master/xandos

 

https://github.com/blackberry/Cascades-Samples/tree/master/xandosdroid

 

Developer
Posts: 59
Registered: ‎09-05-2013
My Device: Z10
My Carrier: *

Re: WebView in a headless app

Yes I know that headless apps can't have a UI, but the using the WebPage should be usable, right? The documentation says "A webpage that can be used when the app needs to interact with web content but not display it." 

Retired
Posts: 249
Registered: ‎07-14-2008
My Device: Not Specified

Re: WebView in a headless app

Did you add cascades10 in your .pro file of the headless project. You can try adding that but I highly doubt it will work as you are not supposed to add cascades10 library to your headless project. The bb/cascades package should not be usable from headless.
Developer
Posts: 59
Registered: ‎09-05-2013
My Device: Z10
My Carrier: *

Re: WebView in a headless app

I just tried, but now I have his error "Please use bb::cascades::Application" to instantiate.

Retired
Posts: 249
Registered: ‎07-14-2008
My Device: Not Specified

Re: WebView in a headless app

That sounds right. Now it wants you to use bb::cascades::application instead of bb::application which would lead to another error. Please do not use any classes from bb/cascades package.
Highlighted
Developer
Posts: 59
Registered: ‎09-05-2013
My Device: Z10
My Carrier: *

Re: WebView in a headless app


shaque wrote:
That sounds right. Now it wants you to use bb::cascades::application instead of bb::application which would lead to another error. Please do not use any classes from bb/cascades package.

This mean it is not possible to use any bb::cascades class in a headless app? So there is no solution?

Retired
Posts: 249
Registered: ‎07-14-2008
My Device: Not Specified

Re: WebView in a headless app

Not at the moment. Can you share some details on your use case here or why you need to use this class in your headless project. I will raise it internally..

Thanks.

Shadid
Developer
Posts: 59
Registered: ‎09-05-2013
My Device: Z10
My Carrier: *

Re: WebView in a headless app

[ Edited ]

shaque wrote:
Not at the moment. Can you share some details on your use case here or why you need to use this class in your headless project. I will raise it internally..

Thanks.

Shadid

My goal is to provide notifications parsed from a web service injecting javascript, when application is not running in foreground. 

Developer
Posts: 169
Registered: ‎03-25-2011
My Device: Playbook, Z10 L.E.
My Carrier: Vodafone NL

Re: WebView in a headless app

Hi there!
I'm also trying something similar. Here's my post:
http://supportforums.blackberry.com/t5/Native-Development/QScriptEngine-on-Headless-app/m-p/2840956
Cheers!