How to Deploy HTML5 Applications for BlackBerry 10

When I test HTML5, I prefer a device over a simulator.

In order to build an HTML5 application for BlackBerry 10, there are a few steps to be followed. Do not worry, it is not too complicated, but there are a few pitfalls you will want to avoid.

Step 1: Install the WebWorks SDK

First, go and download the WebWorks SDK for BlackBerry 10, then install:

https://developer.blackberry.com/html5/download/

Step 2: Add “config.xml” to your project

In the root of your project directory, add a “config.xml” file, similar to this sample:

https://gist.github.com/jgranick/5328711

You can find more detail on the file syntax by reading the W3C Widget recommendation:

http://www.w3.org/TR/2012/REC-widgets-20121127/#example-configuration-document

Step 3: Package

Next, you need to zip your application. “config.xml” should be at the top of your compressed file structure.

Open a command-prompt or terminal and navigate to the directory where WebWorks is installed. You need to have a keystore or valid debug token to deploy on a BlackBerry 10 device. If you do not have one, these resources may help:

http://developer.blackberry.com/html5/documentation/signing_setup_bb10_apps_2008396_11.html
http://www.joshuagranick.com/blog/2012/04/24/how-to-create-a-keystore-for-blackberry/

If you would like to perform a signed build, make sure the “author.p12″ keystore is in the proper directory. If you are not sure about the directory, look at the “Signing Setup” link above.

Run the following command to sign and package the application, using your *.zip path and signing password:

bbwp path/to/the.zip --password 1234

If you would rather build a debug package, make sure a copy of your “debugToken.bar” file is located under the WebWorks directory, as it will not find the file elsewhere. Then you can package using this command:

bbwp path/to/the.zip --debug

Other helpful flags include “–buildId” for controlling the build ID on signed packages and “–output” for putting your generated *.bar packages in a different target path.

Step 4: Deploy

With the command-prompt or terminal, browse to “dependencies/tools/bin” inside the WebWorks directory.

You need to know the IP address of your device, as well as the device password. If you have not enabled developer mode, make sure it is enabled before you try to deploy. When the device resets, it turns off developer mode, so you may have to double-check that it is on.

Use “blackberry-deploy” to install or run your application:

blackberry-deploy -installApp -launchApp -device 169.254.0.1 -password 1234 path/to/the.bar

If you signed your application, you can also submit to BlackBerry World. If you encounter any problems, let me know and I will be glad to help!