Table of contents
24 February 2011
The BlackBerry PlayBook runs the BlackBerry Tablet OS, which includes Adobe AIR and Adobe Flash Player. This means that with the BlackBerry Tablet OS SDK, you can develop AIR applications for the BlackBerry PlayBook. The BlackBerry Tablet OS SDK provides tools to package and deploy your BlackBerry Tablet OS applications (.bar) to the PlayBook simulator.
This article walks you through building, packaging, and deploying the Twitter Trends Flex mobile sample application using Flash Builder "Burrito" preview release and BlackBerry Tablet OS SDK.
The BlackBerry Tablet OS SDK for Adobe AIR provides the necessary libraries to build AIR applications for the PlayBook. The Tablet OS SDK provides a library of UI classes that are the same classes used by the PlayBook itself (AIR is used for the PlayBook’s UI). Along with Tablet OS specific libraries, the SDK provides the tools to package and deploy PlayBook applications (.bar) to the PlayBook simulator.
The BlackBerry Tablet OS SDK for Adobe AIR does not include the Flex SDK. The mobile-centric Flex SDK and tooling is called Flex "Hero" and Flash Builder "Burrito". Both the BlackBerry Tablet OS SDK and Adobe's tooling will continue to progress and integrate closely in the future. RIM provides a plug-in for developing, packaging, installing, debugging, and deploying PlayBook apps for Flash Builder 4 and Flash Builder "Burrito". This article shows how to use the current preview of Flash Builder "Burrito" with the current BlackBerry Tablet OS SDK.
Before proceeding with the article, please download the BlackBerry Tablet OS SDK for Adobe AIR and BlackBerry Tablet OS simulator. Then follow the instructions included in the getting-started guide for installing the BlackBerry Tablet OS SDK and the simulator.
The BlackBerry Tablet OS SDK for Adobe AIR can be used with existing or new Flex mobile projects. To demonstrate how this works, the TwitterTrendsForPlayBook.fxp Flash Builder Flex mobile project is provided for you to download. This project is a Flex mobile project type that was created in Flash Builder "Burrito" preview.
Importing the Twitter Trends project
Open up Flash Builder "Burrito" preview and create/open the appropriate workspace. Then in Flash Builder, follow these steps:
- Select File > Import > Flash Builder > Flash Builder Project and click the Next button.
- With the File option button selected, click the Browse button and navigate to the downloaded TwitterTrendsForPlayBook.fxp file.
- Select "Import new copy of project" and click the Finish button.
Enabling BlackBerry Tablet OS platform for an existing app
The TwitterTrends application was created as a Flex mobile project with only the Android platform selected. With the BlackBerry Tablet OS SDK for Adobe AIR installed correctly, Flash Builder "Burrito" also provides project configuration for the BlackBerry Tablet OS. To enable the BlackBerry Tablet OS platform on an existing project, go to the project properties panel and select Flex Build Packaging > BlackBerry Tablet OS. In this dialog box, select the "Enable this target platform" check box and click OK (see Figure 1).
Running on the desktop
The application can be run on the desktop or on the (VMWare-based) PlayBook simulator. When you run the application for the first time, it will open the dialog shown in Figure 2 to allow you to make desktop or device configurations.
Go ahead and select the desktop option and BlackBerry PlayBook device template (see Figure 3).
Now click the Run button and view the application on your desktop.
Creating a new Flex mobile project targeted for the PlayBook
Flash Builder "Burrito" provides a few new project types, most notably the mobile projects. In the Packager Explorer area right click and follow the these steps:
- Select File > New > Flex Mobile Project.
- Enter MyFlexApp for the project name and click Next.
- Choose your application template: Mobile Application (default) or Blank. The Mobile Application template creates a view-based application and is specific to Flex mobile projects.
- Click the Finish button.
By default, the new BlackBerry Tablet OS platform check box should be selected along with Google Android (see Figure 4).
With the project created, you can add components to the main view or blank application. Now you can run your project just like the TwitterTrendsforPlayBook project. Upon running the application, you will select a platform and run it on the desktop or device.
The PlayBook simulator running in VMWare does not provide any hardware buttons. There are some gestures that can help with closing and navigating between Tablet OS applications. To minimize a running .bar application, make a swiping motion with your mouse from the bottom of the VM upward (starting in the black part of the VM window but not in the Tablet OS itself). With the application in the top quarter of the screen and the application list view below, it's possible to close the application. Make another upward-swiping mouse motion starting on the application this time. The application will disappear into the top toolbar and close.
Making a swiping mouse motion from the left or right of the VM while the .bar application is running puts the OS into another application navigation mode. This mode lets you swipe left or right to all the running applications.
You can swipe down from the top of the VM into the PlayBook main screen. This is the swipe-down hardware gesture, and the only one that you have access to as a developer. Typically this is used for second navigation or context menus.
The BlackBerry Tablet OS SDK for Adobe AIR also provides libraries to access some of the PlayBook specific AIR APIs, ie: QNXApplication’s SWIPE_DOWN event listener or the BlackBerry PaymentService APIs. These PlayBook specific APIs only work with the AIR runtime on the PlayBook, meaning on the simulator and device and not on the desktop.
The BlackBerry Tablet OS SDK also provides some QNX UI components that are the same ActionScript-based components that RIM is using to build native PlayBook applications. Both the QNX UI components and Flex mobile components work well on the PlayBook, but they currently do not work together. The best place to find more information on the current state of the APIs and usage of frameworks together is on the BlackBerry Developer forum for Tablet OS for Adobe AIR.
Both the BlackBerry Tablet OS SDK and Flash Builder will continue to iterate on the AIR application development workflow. Using Flex mobile projects for creating PlayBook apps, as well as apps on other platforms, is a great choice for many types of tablet applications. Find more information regarding BlackBerry Tablet OS SDK for Adobe AIR development on the BlackBerry Tablet OS developer page in the Adobe Developer Connection.