Tuesday, January 25, 2011

I said I would post some tips, so here we go with "Getting started with Blackberry Playbook WebWorks SDK for Mac OSX." These are just a few things that caught me out when I was getting started, so hopefully this will help you.

As a bit of background, I'm more familiar with C++ coding on Windows with Visual Studio and more recently using XCode on OSX for iOS apps, so Blackberry and WebWorks was all new to me. I've done web development on both Windows and Mac before, so WebWorks seemed like a good way to get started.

You should follow the getting started guide on the Blackberry website. It makes it pretty simple, but there are a few things that took me a few tries to get right.

First, I needed to install the Adobe Air SDK 2.5. That just means unzipping a download from the Adobe website, but it needs to be unzipped to a path without a space in it. You then choose that folder in the WebWorks installer, which asks where the Air SDK is installed. I kept getting an error along the lines of "incorrect Adobe Air SDK installed" because I had a space in the path at first.

There isn't much to the WebWorks SDK itself, (although there are a few calls you might need, such as detecting a wireless data connection.) You can just make any HTML5 web page in the tool of your choice and it should hopefully work. The main thing you need the SDK for is the compiler, "bbwp."

When compiling apps you need to run bbwp. I was using Terminal to do that and it is much easier to do after adding the path to the bbwp folder to the $PATH environment variable. To do that on OSX you run
sudo vi /etc/paths
in Terminal and add your path, (e.g. "/Users/Ash/bbwp".)
You can then open a folder in Terminal which contains a zip file of the app's source and run "bbwp my.zip" which will create "/bin/my.bar".

Then you need to deploy the .bar file to the Playbook simulator. Here is an example command to deploy a compiled bar:
./blackberry-deploy -installApp -password ***** -device ***.***.***.*** -package /Users/Ash/Downloads/Blackberry/bin/sketchPadStandard.bar
In that example I haven't added the blackberry-deploy executable's path to $PATH, so I had to add ./ to the beginning and run it from:
You get the device's IP address and set a password for the tablet by enabling developer mode in the device's settings, then clicking the hammer on the home screen.

After getting my environment setup one evening after work, I managed to build a functional app in one day that weekend, (with a bit of help from w3schools.com to help me brush up on my HTML5 and JavaScript skills.) I've just been adding a bit of polish while I wait for my Blackberry developer account to be approved, then I should be submitting asap!

I hope that helps! Let me know your tips in the comments section below.


Passing Score said...

Thanks!! I couldn't figure out what the hell was wrong with my install command until I found this real example. The RIM documentation is worthless at least for the Mac platform. Thank You!

Ashley Bennett said...

I ported Rack 'Em to the PlayBook using WebWorks and HTML5. It's free, so if you have a PlayBook you can grab it from BlackBerry App World.