While I’ve been hacking away at building some of my own BlackBerry® WebWorks™ applications for the BlackBerry® PlayBook™ tablet, I’ve come up with a “getting-started” recipe that works for me, so I figured I would share it with the community. I also have some nifty little scripts that I’d like to share.
Getting Up and Rolling
You can find a full BlackBerry WebWorks Getting Started Guide for BlackBerry PlayBook Tablet OS that will step you through the whole process for either Mac® or Windows®, but I figured I would give a quick cheat sheet on the steps I typically follow.
- Download and extract the Adobe® AIR® SDK. This is actually a zip file that you’ll extract to a directory on your machine – you’ll want to remember it because the SDK installer asks for it later.
- Download and install the BlackBerry WebWorks SDK for Tablet OS. The link I supplied is to the general SDK download page, so it doesn’t become obsolete when we make the next Beta drop. You should find the download link in step 3 on that page.
- Download and install VMware Player if you’re on Windows or VMware Fusion if you’re on Mac OS X. Why? The BlackBerry PlayBook tablet simulator is actually a VMware instance just as if you were running Windows or Linux in VMware. Unfortunately, VMware Fusion doesn’t currently have a free offering for Mac OS X, but we are working closely with VMware to streamline and improve the entire simulation experience for developers.
- Download and install the BlackBerry PlayBook tablet simulator. The only thing this install does is extract the Tablet OS *.iso file to a directory on your machine. Remember your install location because you’ll need this *.iso file to load into VMware. Again, I just linked to the main download area, so that link will still be good when new versions of the simulator are released. The download should be in step 5.
- Run VMware and load the PlayBook *.iso file. See the Windows or Mac setup instructions.
- Now you’re ready to rock and roll with my tips below
You’re probably thinking that these are a lot of steps to get your environment set up – and we agree! We’re working hard to simplify this setup process, and we’ll have a post up soon to share some insights on the steps we’re taking to do just that.
Cutting to the Chase
I’d like to share some tips that I use when building BlackBerry WebWorks applications for the Tablet OS. Since there are a few steps and different command line tools involved, I like to create myself a nice little batch file that does all the heavy lifting for me.
Since I’m typically only working on one application at a time, I usually create a batch file for each one of my projects. You could make your batch files a lot more generic for reuse, but I like the simplicity of not having to pass in command line parameters.
The first thing I usually do is create a virtual directory on a local web server running on my machine. This way I can use a browser like Chrome to do my application testing and perform my debugging using Web Inspector – I find that it’s the closest browser for accurate rendering on the BlackBerry PlayBook tablet. I can write and test my application out in Chrome just like any other web site and then package it up and try it out on the simulator when I‘m ready. We also have some pretty cool plans for some new web tooling and device emulation that we’ll talk about soon.
I then grab a free zip utility like the 7-zip command line tool and use it to zip up my website’s content so that I can pass it to the bbwp command line tool (bbwp stands for BlackBerry WebWorks Packager). I usually delete the pre-existing archive first before zipping up a new one. You’ll have to change the paths below to represent your application’s resources. I just zip up all the files in the root of my website using the “*” wildcard with 7-zip. For this example, I’ll be using the sample SketchPad application:
del "D:\sketchPadStandard.zip" "C:\Program Files\7-zip\7z.exe" a "D:\sketchPadStandard.zip" "D:\sketchPadStandard\*"
Then I run the BlackBerry WebWorks Packager to bundle up the content into an application that can be pushed onto the simulator:
"C:\Program Files\Research In Motion\BlackBerry WebWorks Packager for PlayBook\bbwp\bbwp.exe" "D:\sketchPadStandard.zip" /o "D:\packaged"
The packager will output the sketchPadStandard.bar file to the directory specified by the /o parameter, which in this case is pointing to the “D:\packaged” directory.
Last step is to run the script to load the application onto the BlackBerry PlayBook tablet simulator.
"C:\Program Files\Research In Motion\BlackBerry WebWorks Packager for PlayBook\bbwp\blackberry-tablet-sdk\bin\blackberry-deploy.bat" -installApp -password qaqa -device 192.168.71.128 -package "D:\packaged\sketchPadStandard.bar"
You’ll notice that I pass my local password “qaqa” for the -password parameter and -device 192.168.71.128 which is the IP address from my simulator. Make sure your simulator is set to Development Mode before trying to deploy your app. That detail caught me off guard a couple of times.
Once it’s all put together, the full batch file looks like the following:
del "D:\sketchPadStandard.zip" "C:\Program Files\7-zip\7z.exe" a "D:\sketchPadStandard.zip" "D:\sketchPadStandard\*" "C:\Program Files\Research In Motion\BlackBerry WebWorks Packager for PlayBook\bbwp\bbwp.exe" "D:\sketchPadStandard.zip" /o "D:\packaged" "C:\Program Files\Research In Motion\BlackBerry WebWorks Packager for PlayBook\bbwp\blackberry-tablet-sdk\bin\blackberry-deploy.bat" -installApp -password qaqa -device 192.168.71.128 -package "D:\packaged\sketchPadStandard.bar"
Whenever I want to build and deploy my application to the simulator, I simply run my batch file and I’m good to go!
Uninstalling your application is pretty straight forward as well – an example script can be found below:
"C:\Program Files\Research In Motion\BlackBerry WebWorks Packager for PlayBook\bbwp\blackberry-tablet-sdk\bin\blackberry-deploy.bat" -uninstallApp -password qaqa -device 192.168.71.128 -package "D:\packaged\sketchPadStandard.bar"
Hopefully you’ll find these scripts helpful to get you on your way to building a great application for the BlackBerry PlayBook tablet. We invite you to share yours, too.