The HTML5 key to the doors of BlackBerry World (aka BlackBerry 10 WebWorks SDK Updated)

As we promised a few weeks ago, a BlackBerry® WebWorks™ SDK would be released soon that would have compatibility of applications moving forward. That day has arrived with the latest update to the BlackBerry 10 WebWorks SDK! Applications that are built with this BlackBerry WebWorks SDK will run on the latest delivered BlackBerry® 10 OS beta version as well as future OS updates.

Note that this does not mean that APIs don’t have the potential to change in the future, and there will certainly be more APIs added – but an application binary compiled with this SDK will continue to run on future OSes. With this guarantee, you can now build your BlackBerry WebWorks applications and submit them to the BlackBerry App World™ storefront for approval. You can now also apply for the Built For BlackBerry program before January 21st 2013 to take advantage of our 10k Developer Commitment to developers.

However, no BlackBerry WebWorks release would be complete without some new API additions. We have a ton of great stuff so let’s dive in.

Perhaps our biggest addition is the ability to integrate with the Calendar on the device. Create, edit, delete – it’s all there. It also delivers access to all calendars available on the device while of course respecting the work/personal boundary provided by BlackBerry Balance™. Combine this with the Contacts API delivered in the previous release for some very compelling applications that integrate with the BlackBerry 10 integrated PIM story.

Everyone likes toast (well, they should), and BlackBerry 10 has brought a mobile flavor to this breakfast staple with the Toasts notification concept. Toasts are quick, non-blocking notifications to the user that your application has performed some action, which are displayed for a minimal amount of time and then disappear. You can also enhance your toast with butter a button that allows the user to take some action in relation to that toast (eg. a toast that notifies the user that an item was deleted, and provides an Undo action). Check out blackberry.ui.toast for more on this one.

blackberry.ui.toast.show(“Pass the jam!”, options);

Now, wouldn’t it be cool if you could have a sensor in your phone that would tell you that your toast is ready before it was burnt? Well, no, we can’t do that (yet). But with this release of BlackBerry WebWorks, you now have access to a whole host of new sensor APIs. Orientation, light, proximity, compass, space-time disturbances; okay, not space-time, but yes on the rest. Leverage these APIs to add some real value into your application based on the device environment.

In the previous release of BlackBerry WebWorks, we provided a way to lock the orientation of your application by setting a flag in the config.xml. We have now provided a full JavaScript® API that allows you to lock/unlock your application dynamically based on your own logic. There are a few things to note with this change: To have a good JavaScript API signature, we are putting the orientation functionality right on the blackberry.app namespace, but this is out of line with the current config.xml approach of putting the parameter on the blackberry.app.orientation feature. So we have deprecated this, and now you should put orientation in config.xml on the blackberry.app feature. Also, if you do choose to set it in config.xml, that is a constant value that cannot be overwritten by the API – what you set in config.xml is what you get.

Speaking of config.xml, with this release we have all the pieces in place to allow for full localization of your application, including the display name of your application as well as the description. In the config.xml, you just need to put the localized text inside another element with the xml:lang attribute for the language. Furthermore, all of the built-in UI components are fully localized and reflect the current system language.

Let’s now take a look at some enhancements made to the underlying BlackBerry WebWorks platform. With this release, we have delivered a number of different optimizations to the runtime initialization process. Lots of highly technical, egghead type stuff. Long story short – your apps should load a whole bunch faster for your end users. Be sure to get the latest BlackBerry 10 OS build to see the full benefit.

Perhaps even more interesting is the addition of a child web view control. If you have a link in your content with target=”_blank” or use the window.open function, the content will now be loaded in a child web view that looks much like a card and won’t overwrite your current content. The user can then cancel the view to return to the originating page. When you use window.open, you will receive a window object for the child web view. One of the more obvious use cases here is a more seamless method of supporting OAuth for authentication into social networks like Facebook®, foursquare, Twitter®, and so on.

We have also added a new attribute to the element in config.xml that allows you to specify a single HTTP header key-value pair. This HTTP header will be added to every HTTP request sent from your application. This allows your backend system to key off of this header and perform any required customized processing for your app.

<widget rim:header=”header:Goooallll!”>

If that wasn’t enough on its own, we have also added a few new tooling features that should make your life a lot easier. First on deck is the ability to pass your application’s root folder into the bbwp tool to package your application. No more requirement to first zip your application content and risk feeling silly when you forget to update your zip file with your latest changes. The packager also supports ignoring folders and files within your application folder hierarchy; just create a “.bbwpignore” file in the root folder and list the folders and files you don’t want to be part of your application packager. The format of this file is essentially the same as the .gitignore file, with one or two very small differences.

Another potential time saver and headache reliever is a new facility that will allow you to forget about ever needing to update the version of the webworks.js file you reference in your app. In your application files, reference the webworks.js file like so:

<script src=”local:///chrome/webworks.js”>

The packager tool will include the latest webworks.js into your package and put it at the appropriate location to be loaded.

So there you have it. It is worth reiterating that with this release you can now submit your apps to BlackBerry App World and be assured they will run properly come launch of BlackBerry 10! So submit early so you can get your application approved, and then apply for the Built For BlackBerry program before January 21st, 2013. No time to waste – grab the SDK today!

About Ken W

Ken is the Senior Product Manager for the WebWorks group at BlackBerry. He is responsible for WebWorks tooling and is heavily involved in the Open Source projects at github.com/blackberry and the Apache Cordova community. Ken has a particular interest in trying to bring the internal and external BlackBerry development communities closer together.

Inside BlackBerry Developers

The views expressed on any corporate or individual's personal website or any Twitter account are not necessarily those of BlackBerry. The user's Twitter account and/or personal website, any corporate website, or any comments contained on any of the foregoing have not been reviewed by BlackBerry and do not constitute an endorsement by BlackBerry.