Rebuild: Porting to the PlayBook via Adobe AIR and FlashDevelop

Pugs Luv Beats
I helped demo IGF nominees Faraway and the very musical Pugs Luv Beats.
Last week was my first GDC as an indie developer, and hoh boy were those goodtimes!

I helped Colin present in a talk about failure (Incredipede was the happy ending), and co-demoed Steph Thirion’s game Faraway in the Independent Games Festival. During the awards ceremony they gave us all BlackBerry PlayBooks, so I now have little excuse not to port Rebuild to it.

I sat down to get it running today and spent far too long stepping through RiM’s convoluted developer security setup, which took me even longer than Apple’s similarly obtuse system. There are several tutorials out there but some were out of date or assume you have Flash Builder (I use FlashDevelop). So as of March 2012, here’s what you do to get your SWF running as an app on your PlayBook:

Step 1: Request a CSJ code signing key from BlackBerry.com (takes a couple hours).

Step 2: Get the Flex SDK, AIR SDK, and BlackBerry AIR SDK. I had trouble with Flex4.6 + Air3.2 so I used Flex4.5 with Air 3.1.

Step 3: Start dev mode on your PlayBook in Options > Security > Development Mode.

Step 4: Edit & execute the following to install the debug token on your PlayBook (ten steps and five different passwords, seriously?):

@echo off

:: BlackBerry development token 
:: More information:
:: https://bdsc.webapps.blackberry.com/air/documentation/ww_air_testing/Create_a_debug_token_CMD_ms_1968147_11.html
:: http://www.hsharma.com/tutorials/10-easy-steps-to-package-and-sign-air-apps-for-playbook/
:: http://docs.blackberry.com/en/developers/deliverables/27280/Running_unsigned_apps_debug_tokens_1585072_11.jsp
:: http://openbbnews.wordpress.com/2011/11/16/installing-a-debug-token/
:: http://www.mellisdesigns.com/blog/?p=37

:: Path to Blackberry SDK
set PATH=%PATH%;C:\Program Files (x86)\Research in Motion\blackberry-tablet-sdk-2.0.0\bin

:: Path to Java
set PATH=%PATH%;C:\Program Files (x86)\Java\jre6\bin

echo First get CSJ from https://bdsc.webapps.blackberry.com/air/signingkeys
echo And start dev mode on PlayBook in Options > Security > Development Mode

:: begin setup
call blackberry-signer -csksetup -cskpass [YOUR_PASSWORD]

:: register CSJ locally
call blackberry-signer -register -csjpin [YOUR_PASSWORD] -cskpass [YOUR_PASSWORD] client-PBDT-[XXXXXXXXXX].csj

:: create p12 file
call blackberry-keytool -genkeypair -keystore author.p12 -storepass [YOUR_PASSWORD] -dname "cn=YOUR_NAME" -alias author

:: register device against CSJ
call blackberry-debugtokenrequest -register -csjpin [YOUR_DEVICE_ID] -storepass [YOUR_PASSWORD] client-PBDT-[XXXXXXXXXX].csj

:: later calls expect the p12 here for some reason
call copy author.p12 "C:\Users\USER_NAME\AppData\Local\Research In Motion\author.p12"

:: create the debug token BAR
call blackberry-debugtokenrequest -storepass [YOUR_PASSWORD] -devicepin [YOUR_DEVICE_ID] debug_token.bar

:: sign bar with RIM (remote)
call blackberry-signer -verbose -cskpass [YOUR_PASSWORD] -keystore author.p12 -storepass [YOUR_PASSWORD] debug_token.bar PBDT

:: sign bar with developer (local)
call blackberry-signer -keystore author.p12 -storepass [YOUR_PASSWORD] debug_token.bar author

:: upload debug token to playbook (must be running in debug mode at this address & password)
call blackberry-deploy -installDebugToken debug_token.bar -device [DEVICE_IP_ADDRESS] -password [YOUR_PASSWORD]

:: echo important metadata
echo Add the following authorId to bar-descriptor.xml
call blackberry-airpackager -listManifest debug_token.bar

pause

Step 5: Download this FlashDevelop project adapted from Studio Chris’ BlackBerry template, and edit airplaybook.as3proj and airplaybookConfig.xml to point to your SDK locations.

Step 6: From FlashDevelop, hit F5 to build your SWF and test it locally using ADL.

Step 7: Edit & execute the following to package and install the app:

@echo off
:: AIR application packaging
:: More information:
:: http://livedocs.adobe.com/flex/3/html/help.html?content=CommandLineTools_5.html#1035959
:: http://www.hsharma.com/tutorials/10-easy-steps-to-package-and-sign-air-apps-for-playbook/

:: Path to Flex + AIR SDK
set PATH=%PATH%;C:\Program Files (x86)\Adobe\Flex451AIR31\bin

:: Path to Blackberry
set PATH=%PATH%;C:\Program Files (x86)\Research in Motion\blackberry-tablet-sdk-2.0.0\bin

:: Path to Java
set PATH=%PATH%;C:\Program Files (x86)\Java\jre6\bin

:: package swf and assets into a bar then install to device and run the app
call blackberry-airpackager -package airplaybook.bar -installApp -launchApp application.xml bar-descriptor.xml airplaybook.swf blackberry-tablet-icon.png landscape-splash.png portrait-splash.png -devMode -device [YOUR_DEVICE_IP] -password [YOUR_PASSWORD]

pause

If all goes well, you should see Main.as (a red square on a black background) appear on your BlackBerry. Chances are good that some parts of the debug token installation aren’t necessary but it got the job done.

Rebuild actually ran the first time, and quite well which was an unexpected surprise. Now I need to adjust the fonts and aspect ratio, then go through what promises to be another certification nightmare to package it for sale in the BlackBerry App World. It’ll probably take two or three days total, so no great loss if it bombs.

Rebuild should be out for the PlayBook by the end of the month!

Share

16 thoughts on “Rebuild: Porting to the PlayBook via Adobe AIR and FlashDevelop

    1. No its not! Its common misunderstanding. Read more about this and stop writhing this kind on nonsense. Sorry.

  1. Hi Sarah,

    Alex from RIM here. I just bough Rebuild this is exactly what I need to keep me going now that “The Walking Dead” is done for a while.

    Great to see that you put the PlayBook to great use after GDC – we’re excited to see what other games you can bring to the platform.

    In regards to the issues you had with setting up the tools – here’s a post you might for useful for next time – or for other game developers getting started with BlackBerry PlayBook – http://supportforums.blackberry.com/t5/Testing-and-Deployment/BlackBerry-Tablet-OS-Graphical-Aid/ta-p/1207067

    Have a great day!

    Alex, RIM Social Team

  2. Hey, thanks a lot for this, it saved me tons of time.

    The only comment is that the project won’t compile because the id in application.xml has spaces (“Playbook Air Example”).
    It’d be great to correct that (just changed it to “PlaybookAirExample”) to avoid complicating an already troublesome task.

    Thanks a lot!

  3. I blog often and I genuinely thank you for your content.
    This article has really peaked my interest. I will bookmark your site and keep checking for new details about once a
    week. I opted in for your RSS feed too.

  4. Whoa! This blog looks exactly like my old one!
    It’s on a completely different subject but it has pretty much the same page layout and design. Excellent choice of colors!

  5. You may notice that the concept of compensation plan may
    seem to be common in the networking industry. He knew
    the system well enough to not pay many of his suppliers and sub-contractors,
    then would cover it up up by handing out fake lien releases to make it look
    like they were paid. You wont get a true imitation of your signature
    with this Android app, unless you can cleverly manipulate the
    mechanics behind its operation, but that is highly unlikely.

  6. Cheers to your PROFITmatic Turnkey Automated Internet Profit
    Center,. Wouldn’t it be easier if we could be able to save changes ourselves whenever we want. Once safely at Thebes, though, the obelisks were brought to the temple at Karnak with much fanfare.

  7. All they need to do is to enroll with their name, email, contact number and country and
    vemmabuilder will cater to the particular country of the person.
    It’s a good idea to have separate email promotions for prospects and customers, too, because you typically need to send different information to the different groups. You can make corrections directly instead of having to search mistake through the code, if something does not seem OK for you.

  8. So, what you think might be the technicality
    hidden inside the making of these forms. Joomla has thousands of templates and add-ons that
    are available for free, as well as several professional
    resources available for purchase from third party developers.
    It is the perfect way for the visitors to join the email club of website or visitors can easily subscribe for company’s monthly newsletters.

  9. You may notice that the concept of compensation plan may seem to be common in the networking industry.
    It’s easy to use a fake IP address on i – Phone and i – Pad, but you need to know what you need the fake IP for. You wont get a true imitation of your signature with this Android app, unless you can cleverly manipulate the mechanics behind its operation, but that is highly unlikely.

  10. I loved as much as you’ll receive carried out right here.
    The sketch is attractive, your authored subject
    matter stylish. nonetheless, you command get bought an shakiness over that you wish be delivering the
    following. unwell unquestionably come further formerly again since exactly the same nearly a
    lot often inside case you shield this increase.

Leave a Reply to tamdamdam Cancel reply

Your email address will not be published.