Developing for BlackBerry 10

Just got a new phone, the BlackBerry Classic, after many years with my trusty and beloved BlackBerry Curve 9320. As with any new gizmo, there is much excitement, lots of new features, and some disappointment. The latter includes: too big (the Curve is light and fits in a front pocket; not the Classic), relatively poor UI access/design to core PIM functionality (BB7 is amazingly complete, lightweight and optimized for contacts, calendar, sms, email, etc), relatively poor battery life (my Curve is still sitting here, half-full battery after 5 days!). Ah well. But the Classic’s screen and browser are amazing. And the Hub works very well. Overall, I like it.

So, I had to see how easy it would be to develop for it. And the answer? Very easy! Using the WebWorks SDK, you can develop with HTML5 (with plugins), preview/simulate in Chrome(-ium) with Ripple, and install/test on your phone over USB. All using linux. So here are some notes:

Download BB 10 WebWorks (these notes were made with version 2.2).

Install (chmod u+x BB10...bin; ./BB10...bin)

Get a BlackBerry ID token here and save it to ~/.rim/bbidtoken.csk

Generate a developer certificate (file ~/.rim/author.p12; cn= sets your ‘company name’):

        bb-tools/bin/blackberry-keytool -genkeypair \
        -storepass <ID token password> -dname "cn=MyCompany"

Create the template for your app. Parameters: location, appID (in reverse net domain format, and app name.

      .../BB10WebWorksSDK/webworks create ~/dev/myapp com.acme.myapp "My App"

Edit the app!!! The template, however, will compile fine.

Build it. Either in --dubug mode, in which case you will need to install a debug token on the phone, or in --release mode, in which case you will need to be online so WebWorks can sign your app. The debug token is not needed on the phone, but you will need a --buildId code to specify which version you have just made.

      .../BB10WebWorksSDK/webworks build \
        [ --dubug | --release --buildId <code> ] \
        --keystorepass <token password>

      [INFO]    Populating application source
      [INFO]    Parsing config.xml
      [INFO]    Generating output files
      [INFO]    Package created: .../simulator/
      [INFO]    Package created: .../device/
      [INFO]    Bar signed.
      [INFO]    BAR packaging complete

Install it. For this you will need to connect to the phone via ‘ethernet over USB’ (see below for details on Arch). In developer mode on the phone, the default IP is There may be a way to install files over wifi, but I haven’t solved that yet. The --no-build option installs the previously built .bar file; the build step is actually not needed and run will do both build and install.

      .../BB10WebWorksSDK/webworks run \
        --devicepass <device password> --no-build

      [INFO]    Target Classic-2bfbddf4 selected
      [INFO]    Sending request: INSTALL_AND_LAUNCH
      [INFO]    Installing com.acme.myapp.gYABgI7FMZrTOi27HqE30KDVVlU...
      [INFO]    done

The app should automatically launch! Voila! A working development toolchain. Now time to build something! Try the cool internal sensor sample app for a starter.

ssh access to the BB

And why not?! Thanks to Alexander Todorov for this. Note that a debug token seems not to need to be installed. The new ssh key is not needed if yours is 4096 bits or more.

  cd .rim/
  ssh-keygen -t rsa -b 4096 -f ~/.rim/

    bb-tools/bin/blackberry-connect \
    -password <device password> -sshPublicKey ~/.rim/

In another terminal:

  ssh -i ~/.rim/id_rsa devuser@

And you should be in! There’s a BusyBox running and it’s clearly Linux under the hood! I didn’t know. And... don’t brick your phone now! :-)

Connecting the phone over USB

I still don’t really understand networking, but this works for me. On a modern, netctl-based Arch system:

Create a netctl profile (e.g., /etc/netctl/usb0-bb10):


Plug in the phone to the USB

netctl stop-all ; not sure why I cannot get the phone to connect when the wifi connection is active.

netctl start usb0-bb10 ; should now be able to ping

Restart the wifi connection if needed