First Steps with BlackBerry PlayBook AIR SDK
Last week at Adobe MAX 2010, the BlackBerry Playbook was introduced to the world of developers. Positioned as a powerful multi-tasking environment it promises to pose formidable competition in the tablet landscape. The PlayBook OS is built on QNX, the real-time time-tested OS and offers an Adobe AIR based SDK for developers to write their apps.
As soon as I was back from MAX, I was itching to write my first “Hello World” app using the BlackBerry PlayBook SDK. So here in this post is an account of that adventure.
To get started with the PlayBook SDK, first go to the BlackBerry Tablet OS development resources and download the SDK and the simulator for your platform. You will need to get the appropriate versions of the SDK and the simulator for your platform. At the moment, Mac and Windows are supported. I tried my hand with both Mac and Windows. There are “Getting started” guides for Mac and Windows and that’s where my journey began.
To setup the development environment you need the following:
- The BlackBerry Tablet OS Simulator ISO
- VMWare Player (or VMWare Fusion on the Mac) to configure and run a virtual environment on the basis of the ISO
- AIR 2.5 SDK
- Flash Builder 4.x (the support officially extends to Flash Builder 4.0.1 but you can make it work with FB Burrito)
- BlackBerry AIR SDK
The PlayBook simulator leverages VMWare Player to create a virtual environment for you to test your apps. When I began to follow the steps in the “Getting started” started guide for Mac and wanted to download and install the VMWare Player on a Mac as per the following guidelines: Configure a virtual machine for the BlackBerry Tablet Simulator, I realized a VMWare Player didn’t exist for a Mac at all. So I downloaded a trail version of VMWare Fusion instead to get things working. Once VMWare Fusion is installed one can follow along the instructions in the “Getting started” guide to setup and configure the simulator. Since that is documented and available online it makes no sense to reproduce it here.
Next, I downloaded the BlackBerry AIR SDK. Flash Builder 4.0.1, AIR 2.5 SDK and Flash Builder Burrito were already installed so I did not need to re-install it. If you don’t have Flash Builder and AIR on your machine then please download and install them before you move forward. Installing the BlackBerry SDK was elementary as a wizard guided through the process. However, one little thing was very odd. The BlackBerry SDK refused to deploy to any Flash Builder other than one named: “Adobe Flash Builder 4”. I have Flash Builder 4 installed as a plug-in and have the standalone FB Burrito that does not have a folder name as stated. So I had to hack around the problem by creating a symbolic link named “Adobe Flash Builder 4” to my FB Burrito folder on the Mac. On Windows I just configured the SDK, which I will talk about in a bit.
With that done things were working on the Mac.
On the Windows box, I had a different story. Installing the VMWare Player was no problem. It comes for free and installing it requires clicking the installer. That’s it! However, things got tricky right after that. I downloaded the simulator installer but on clicking the installer was greeted with this lack of 64-bit platform support message:
This I think was quite uninviting. Anyway, I worked around this problem. All I needed from this bundle was the TableOS Simulator ISO, so I extracted the installer using 7-zip and traversed down the extracted folder to BlackBerryPlayBookSimulator-Installer-Win\InstallerData\Disk1\InstData, where I again extracted the zipped up file called “Resource1”. Once extracted, I could get the ISO at Resource1$IA_PROJECT_DIR$\installerdata. From there on I could use the instructions in the “Getting started” guide for Windows to setup the simulator.
As expected, the BlackBerry SDK installer didn’t work on Win 7 either. It again threw up the now familiar message stating lack of Win64 support. Makes me wonder why companies don’t have installers support the 64-bit platform. This is a developer’s tool and not an end user product. Many developers are already using the 64-bit platform and all should and will use it in a couple of years time.
I used the same trick as before and extracted the SDK installer using 7-zip. This time I traversed down the extracted installer to BlackBerryTabletSDK-Air-Installer-0.9.0-Win\InstallerData\Disk1\InstData. There I extracted the “Resource1” zip file and traversed further down to Resource1$IA_PROJECT_DIR$\installerdata. In this folder there are two JAR (Java Archive) files that hold the contents of the SDK. The names of these 2 jar files are as follows:
- blackberry-tablet-sdk-0.9.0_zg_ia_sf.jar
- qnxsdk_zg_ia_sf.jar
Next, I extracted these two jar files using 7-zip again. After this I created a folder in the “applications” folder, which resides at the root of the C: drive and named it “blackberry-tablet-sdk-0.9.0”, essentially all except the “zg_ia_sf.jar” part of the BlackBerry Tablet jar file name. You can choose any other name, say just blackberry-tablet-sdk or any other. Next, I merged the contents of the two extracted jar files and the Adobe AIR 2.5 SDK (which I assume you would have downloaded and setup by now). That was it! It got my BlackBerry Tablet SDK up and running.
Once the SDK and simulator is setup, you can open up Flash Builder and first configure the BlackBerry Tablet AIR SDK by adding it to the list of “Installed Flex SDKs” as shown in the Figure below:
Once the setup was complete, I could finally get to writing the “Hello World” app. I wanted the “Hello World” app to be a bit more exciting than printing “Hello World” out to the screen so used the Google Maps Flash API to draw out a map of the area where the Adobe MAX venue, i.e. the LA Convention Center, was.
To create this app, I created a Flex project in Flash Builder and selected it to be an Adobe AIR application. Then I explicitly chose the BlackBerry Tablet AIR SDK as the SDK and finally I chose an ActionScript file as the main file. (As far as I understood, the SDK doesn’t support MXML directly as of now.)
Once the application was written, I compiled the application as usual and then packaged and installed the application to the simulator. I used the command line to package and install the app. You can read about the command line options online. You will need to retrieve the simulator IP to get this to work. Don’t forget to read about retrieving the IP of the simulator.
The command line packager and installer has a format like so:
blackberry-airpackager -package output_bar_file_name -installApp -launchApp project_name-app.xml project_name.swf any_other_project_files -device IP_address
I will not talk about the app itself at the moment but may cover that in a subsequent post, especially once I integrate with a few BlackBerry TabletOS specific features and gestures.
For now I just include a snapshot of the initial “Hello World” version.
Leave a Comment