BlackBerry Widgets are Here!

News

With the explosion of web applications pushing the boundaries of online vs. offline interactions using technologies such as AJAX, Gears® and HTML 5, the lines between a website and an application are becoming much more blurred.  To help bridge this gap,  RIM has released the BlackBerry Widget SDK 1.0 Beta 1, which will enable widgets starting with BlackBerry Device Software 5.0.

What are BlackBerry Widgets?

BlackBerry Widgets are applications based off of the W3C widget specification as standalone applications created entirely with standard web technology (HTML, CSS, JavaScript).

  • BlackBerry Widgets leverage BlackBerry APIs in a secure manageable container.
  • BlackBerry Widgets have the same distribution/management model as native BlackBerry applications and can be distributed through BlackBerry App World™.
  • BlackBerry Widgets are supported by BlackBerry Device Software 5.0 and up.

The user interface for a BlackBerry Widget is entirely authored in HTML/CSS, allowing developers to apply their existing web development skills toward widget creation. All of the application logic for a widget is written in JavaScript which has access to BlackBerry Widgets APIs that are included as part of the core operating system. Developers can create sophisticated widgets by leveraging built in Gearssupport for multi-threading, local storage via SQLite and also Geolocation capabilities. Beyond Gears, developers have a whole set of APIs that allow access to capabilities such as local file access, PIM interaction, invoking native applications, data push and more.

How do I Create a BlackBerry Widget?

Developers can author a BlackBerry Widget in any of their favorite web authoring tools. As outlined in the W3C specification, developers simply bundle their widget assets into a ZIP archive.

To then transform the archive into a BlackBerry Widget, developers must pass it through the BlackBerry Widget Packager command line software (part of the BlackBerry Widget SDK).

What about Security?

The same content access and IT policies that apply to native applications apply to BlackBerry Widgets. BlackBerry Widgets must be signed with a Research In Motion code signing key to explicitly identify the web resources that can be accessed by the widget. For more information on code signing, check out the security posts on the blog.

Like any web technology, when linking in resources from external sources, developers need to be sure that the content being received is from a trusted source. As well, to protect from a possible “man in the middle” attack, developers can secure their connection to outside resources via HTTPS.

It is also worth noting that BlackBerry Widget APIs apply only to BlackBerry Widgets and cannot be accessed within the BlackBerry Browser.

What if RIM doesn’t provide me with the JavaScript API I am looking for?

RIM will continue to add new JavaScript APIs for BlackBerry Widgets. Most will not require new BlackBerry Device Software upgrades to be used.  Java developers can also create their own custom JavaScript BlackBerry Widget Extension to be packaged with their widget.

This allows developers to create their own custom JavaScript extension library by wrapping any of the BlackBerry native APIs and implementing the provided JavaScript interfaces. Once this is complete, developers can package their JavaScript extension into the widget archive to be distributed with their application.

Getting into the “Nuts and Bolts”

The behind the scenes of the BlackBerry Widget Packager is where your archive is transformed into an installable BlackBerry application. For those who are not familiar with BlackBerry Java development, the following is for reference purposes only and simply explains the packaging process.

The process of using the BlackBerry Widget Packager is to bundle the widget as a native application which utilizes a Browser Field Java control to render the content and run the JavaScript. This could be considered a “Hybrid” application where the same security rules and configuration apply similar to any other Java Application.

When the widget archive is processed by the BlackBerry Widget Packager, all the web assets (HTML, CSS, JavaScript, Images etc.) of the widget are left untouched and are encapsulated as embedded resources. The BlackBerry Widget APIs are then added to the nested Browser Field control.

In Conclusion

I am extremely excited about this new technology, as it drastically simplifies the development process for creating very compelling applications.  The best part is that for all of you web developers out there, you won’t have to learn a bunch of new skills to be able to build powerful on-device BlackBerry applications.

About Tim W.

Tim works on the Developer Relations team at BlackBerry, focusing on WebWorks, HTML5, and Open Source.

Join the conversation

Show comments Hide comments
+ -
blog comments powered by Disqus