One of my favorite features of the BlackBerry® WebWorks™ SDK is the extensions: It’s like having an ace up your sleeve for every development project. You start with one of the most complete HTML5 implementations in mobile, and you can drop down into native code for even more APIs. It gets even better when you factor in the fact that we have a GitHub repository for community contributed extensions, and we’ve even open-sourced the entire BlackBerry WebWorks SDK for both tablet and smartphone platforms. This means you can leverage the contributions of other developers with ease, not only for extensions, but to the core APIs as well.
About a month ago, an extension I wrote to add BlackBerry® Analytics to the BlackBerry WebWorks SDK for smartphones was included in the Community APIs on GitHub, and just this past week, a community developer’s extension to support the Clipboard was added in BlackBerry WebWorks for the BlackBerry® PlayBook™ tablet. Now if you want to use these extensions, you’ll need to download the source and add them to your SDK. Thankfully, this is quite simple to do.
Right in the Readme for the extension you will find instructions:
- Download the source code from this repository and extract it to a location on your computer.
- Using File Explorer, browse to the downloaded source code for this extension: Tablet\Clipboard.
- Copy the downloaded Tablet\Clipboard\blackberry.clipboard directory to the extensions directory for the BlackBerry WebWorks SDK for Tablet OS. The default path for this location is “C:\Program Files\Research In Motion\BlackBerry WebWorks SDK for TabletOS 22.214.171.124\bbwp\ext”.
When you’ve done that, you can build applications with <feature id=”blackberry.clipboard” /> in the config.xml file.
When you add an extension to your SDK, you will see that there are quite a few already in the /ext directory. These core APIs form the basis of the BlackBerry WebWorks SDK and its ability to go beyond the Browser. Since we’ve open sourced the SDK on Github, when an update is submitted for one of the core APIs, it’s just as easy to get the update for yourself.
For example, I submitted an update to the blackberry.utils API so that you can save Base64 encoded Strings as decoded binary Blobs, with the intention of saving Canvas data directly to the file system as an image file. Since this code isn’t part of the official codebase yet, if you want the code that does this in your SDK, go to the SDK on Github, and look at the Pull Requests.
If you click on the actual commit, you’ll see the code change, and you can view the actual file on Github.
If you click on the “Raw” button on the top right, you will get the actual file contents, so you can replace the Utilities.as file in your “C:\Program Files\Research In Motion\BlackBerry WebWorks SDK for TabletOS 126.96.36.199\bbwp\ext\blackberry.utils\src\Air\Utilities\src\blackberry\utils” directory directly.
Visit the GitHub site today and get some more extensions to work with. You’ll be well on your way to expanding your BlackBerry WebWorks SDK into your own custom toolkit for outstanding HTML5 applications with native capabilities.