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

Web and WebWorks Development

Reply
New Contributor
Posts: 8
Registered: ‎03-29-2011
My Device: Not Specified

Does Webworks enable access to native device controls?

I don't know much about Webworks other than our organization is investigating it's use to allow for more robust integration with native alerts/messaging and our web application. My limited understanding of the framework is that it provides a 'wrapper' around a browser window granted us some sort of hooks to some aspects of the native OS components. What I'm specifically researching is what level of access we'd have. For instance, could we trigger a native date picker spinner from a button on our HTML page (I do know we could trigger it via an HTML 5 DATE field). If there is a specific list or bit of documentation that would outline the scope of that, that'd be great. I'd also be interested in hearing from anyone that has researched Webworks vs. a solution such as PhoneGap where you'd write the app in HTML/CSS/JS and compile into a native app. If there are any general comparisons to be made between the two, I'd be interested in hearing them! Thanks!
Regular Contributor
Posts: 65
Registered: ‎01-21-2011
My Device: Not Specified

Re: Does Webworks enable access to native device controls?

Hi

 

I''ve just done this in the project i'm working on at the minute and can tell you that creating a date spinner field native java control certianly is possible. You have to do this by writing a widget extension through as it is not supported out of the box in the web works API... If you take a look at the UIExamples project (here) there is an example html code / css for replicating the native blackberry drop down combo style field... Their example shows a text spinner field to choose countries but you can tweak the supplied widget code (just uncompress the included jar file in the EXT folder) to display a date spinner picker field and some ok / cancel buttons... What that example is doing is displaying a native screen modal window infront of the webworks application and it works quite well.... A bit of faffing about i know but then again most things in webworks seem to turn out that way as i'm finding but you can nearly always get where you need to be.

 

Another tip would be to make sure you use their HTML5 tools (here) to emulate the HTML 5 DB access in the Blackberry OS 5 version of webworks if you plan to suport OS5 an OS6 as they are quite different.... OS 5 uses google gears as a database and doesn't implement HTML5, it run in a synchronous fashion and is a java based browser engine..... OS 6 is a webkit based browser, runs HTML 5, and operates asynchronously (this bit us in the bum and had to refactor more of  less the whole app to get it working on OS6...). On OS6 you have to perform any lengthy operation asynchronously (and by lengthy i mean more than a few milliseconds) or the OS appears to swat your app down and kill it as having become unresponsive unless thats been sorted out in the latest webworks sdk release the other day... 

Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: Does Webworks enable access to native device controls?

>> My limited understanding the framework is that it provides a 'wrapper' around a browser window granted us some sort of hooks to some aspects of the native OS components.

 

Correct - the tools package your Web content (HTML, CSS, JavaScript, etc) into a headless browser container (powered by WebKit on BlackBerry 6 and BlackBerry Tablet OS).  The tools also provide JavaScript-based APIs that can to connect this Web content with certain features and capabilities from the underlying OS:

 

 

 

>> What I'm specifically researching is what level of access we'd have. For instance, could we trigger a native date picker spinner from a button on our HTML page (I do know we could trigger it via an HTML 5 DATE field).

 

Although HTML5 input fields do provide the Web engine with a mechanism for providing custom input controls, based on the value of the type property, WebWorks developers do have an additional way of providing native functionality to their applications: custom JavaScript extensions.  Identical in principle to the WebWorks JavaScript APIs, extensions are a way of packaging Java (for Smartphone) or ActionScript (for PlayBook) code into a container that can be accessed via JavaScript.  This provides potential for access to all native functionality on the given device.

 

I would be very happy to learn what others have to say about comparing PhoneGap to WebWorks, especially those developers who have had experience using both products.  From my perspective, they are both great SDKs that developers can use to turn Web content into native applications.  However PhoneGap has a cross-platform story, while WebWorks is tuned specifically for BlackBerry.

 

Hope that answers some of your questions.

 

Cheers,

Adam

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.