main :: IO ()

main = do

    putStrLn ( "" ++ githubUser )

    putStrLn ( "" ++ twitterUser )

    putStrLn ( "" ++ linkedinUser )

    putStrLn ( "14D4 0CA1 E1A8 06A0 15C4 A06B 372E C33E B388 121A" )

    where twitterUser = "mpmlopes"

          linkedinUser = "mpmlopes"

          githubUser = "mlopes"

Debug Tokens for Blackberry Playbook development with NME

Mar 7, 2013 • blackberry,nme,haxe( 4 min read )


When I first started looking at generating debug tokens for the Blackberry Playbook, it was very hard to find the correct documentation on how to do it, and to distinguish between the deprecated and current ways of doing it. When my debug token expired, I had to generate a new one, and I immediately missed some documentation I could have created highlighting the steps I took when I did it the first time. After looking at some old e-mails and IRC logs, I was able to get enough information to do it again, and it even seems that the official documentation got improved. Nevertheless I decided to go ahead and document how I did it.



First we’ll need to have a developer account on the Blackberry developers website so we can request a debug token signing file. When I did this, I received back an e-mail with a client-RDK-xxxxxxx.csj and a client-PBDT-xxxxxxx.csj file attached. The file we’ll need to use for signing your debug token is the client-PBDT-xxxxxxx.csj one. We will also need to have the Blackberry NDK installed on the computer we’ll be using to create and sign the token. In this post the NDK will be installed in /Developer/SDKs/bbndk-2.1.0-beta1 and the keys placed in ~/.bbkeys, therefore these are the paths we’ll be using on all the examples.

Before starting, we’ll need to get the PIN of the device we want to create a key for. On the Blackberry device, go to SettingAbout. From the View information about your tablet drop-down on the right, select Hardware and take note of the PIN. The PIN should look something like 1234ABCD.

Move into the ~/.bbkeys folder:

$ cd ~/.bbkeys

Now use the blackberry-debugtokenrequest utility, on the computer, to generate the token. We will need to provide the PIN we got from our device, the password used on our developer account to request the signing keys, and the name of the “bar” file which will be the token file itself.

$ /Developer/SDKs/bbndk-2.1.0-beta1/host/macosx/x86/usr/bin/blackberry-debugtokenrequest -storepass mystorepassword -devicepin 1234ABCD

If everything went ok, we should now have a file on our ~/.bbkeys folder. We will now need to install the debug token to the Blackberry device. This is done using the blackberry-deploy utility.

Before installing the token, lets get some information we will need from the device again. Open SettingsSecurity and find the Developer Mode section. Make note of the device IP address displayed on the Developer Mode section and activate the developer mode.

Back to the computer, lets run the blackberry-deploy utility using the name of the file created with the blackberry-debugtokenrequest, the password we set on our device when we enabled developer mode and the IP address we took note on the previous step:

$ /Developer/SDKs/bbndk-2.1.0-beta1/host/macosx/x86/usr/bin/blackberry-deploy -installDebugToken -device -password mydevicepassowrd

And that’s it, we now have our debug token, and installed it to the Blackberry device…

… well not quite, there’s still one more step to go. The reason we went through all this trouble was to be able to test our Applications on our device, so now we need to sign our application with the debug token.

Adding it to our NME application

Making NME aware of our debug token is quite easy. All we need to do is to run nme setup blackberry and provide it with all the information it will ask us. At this point, we already possess all of this information, so it should be pretty straightforward. Just execute the following command:

$ nme setup blackberry

We can check, or manually change the configurations generated by this script by editing the .hxcpp_config.xml in our home folder. The contents of the file should look something like this (all non-blackberry related configurations are removed from this example):

    <section id="vars">
        <set name="BLACKBERRY_DEVICE_PASSWORD" value="mydevicepassowrd" />
        <set name="BLACKBERRY_SETUP" value="true" />
        <set name="BLACKBERRY_DEVICE_IP" value="" />
        <set name="BLACKBERRY_NDK_ROOT" value="/Developer/SDKs/bbndk-2.1.0-beta1" />
        <set name="BLACKBERRY_DEBUG_TOKEN" value="/Users/mlopes/.bbkeys/" />


And that’s it, we should now be able to compile our application and test it on the blackberry device. Plug in the device and compile the application:

$ nme test amazingApp.nmml blackberry

If you'd like to keep up to date with new posts, follow me on twitter @mpmlopes ,
or subscribe to the feed.

Follow me on twitter @mpmlopes