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).
chmod u+x BB10...bin; ./BB10...bin)
Get a BlackBerry ID token here and save it to
Generate a developer certificate (file
cn=sets your ‘company name’):
.../BB10WebWorksSDK/cordova-blackberry/bin/dependencies/\ 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
--dubugmode, in which case you will need to install a debug token on the phone, or in
--releasemode, 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
--buildIdcode 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/bb10app.bar [INFO] Package created: .../device/bb10app.bar [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 169.254.0.1. There may be a way to install files over wifi, but I haven’t solved that yet. The
--no-buildoption installs the previously built
.barfile; the build step is actually not needed and
runwill 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.
sshaccess 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/id_rsa.pub .../BB10WebWorksSDK/cordova-blackberry/bin/dependencies/\ bb-tools/bin/blackberry-connect 169.254.0.1 \ -password <device password> -sshPublicKey ~/.rim/id_rsa.pub
In another terminal:
ssh -i ~/.rim/id_rsa firstname.lastname@example.org
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! :-)
I still don’t really understand networking, but this works for me. On
netctl-based Arch system:
Interface=usb0 Connection=ethernet IP=static Address=169.254.0.2/24
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 169.254.0.1.
Restart the wifi connection if needed