Wednesday, September 14, 2011

BlackBerry Tablet Development with Flash Builder 4.5.1

If you're attending the Adobe MAX preconference hands-on code camp that Garth Braithwaite and I will be delivering, you'll need to do some preparation in advance.

In this post, I outline the steps for BlackBerry Tablet preparation, which should be done well in advance if you want to run the code-camp application on the device.

Below is a depiction of the steps required. 




Figure courtesy of Research in Motion.

 0.  Request BlackBerry code signing keys, and obtain RDK and PBDT CSJ files from BlackBerry at https://www.blackberry.com/SignedKeys/. According to RIM, it may take up to two hours to receive the keys in  via email. (You may want to leave a bit of leeway here, mine took about three hours to arrive.)
 


1.       Once the emails arrive, save both of them to your local file system. For convenience, I set up a folder inside my Flash Builder 4.5.1 workspace named BlackBerryDev and saved both of the CSJ files to that folder.


 



  Note: If you want to know what these files are, check out the additional documentation at this URL:  http://docs.blackberry.com/en/developers/deliverables/23959/Signing_your_application_1422721_11.jsp

Basically the file with the PBDT is a PlayBook Debugging Tool.  The RDK one is not easy to find information about.

2.       Start Flash Builder 4.5.1.  

3.       Choose Flash Builder > Preferences (or Window > Preferences) to open the Preferences dialog box.

 4.      In the Preferences dialog box, select Flash Builder > Target   
   Platforms > BlackBerry Tablet OS as shown below.
 


 

5.    Click the "download and install the SDK" link.

6.    When you click the link, your default browser will open and load the page at http://us.blackberry.com/developers/tablet/ . Click the "BlackBerry Tablet OS for Adobe AIR" link in the bottom left.

7.    Then click either Download BlackBerry Tablet OS SDK for AIR for Windows or Download BlackBerry Tablet OS SDK for AIR for Mac.


 

8.    Shut down Flash Builder during the next few steps.

 
9.    When the download is finished, click the installer and install the SDK.  There are several steps to pay close attention to.
  
10.    When asked if you want to integrate with Flash Builder, select Yes as shown below.

 In the next step you will be asked where Flash Builder is installed.  By default, this will be /Applications/Adobe Flash Builder X.X (on OS X) and c:\Program Files\Adobe\Adobe Flash Builder (on Windows).  DO NOT confuse this with the location of the current workspace used by Flash Builder.

 

11.    Next you will be prompted for a location to install the BlackBerry SDK.  As with the CSJ files above, I chose to use the folder BlackBerryDev under the Flash Builder workspace in order to keep all assets in one place.

12.    Click Next, and then click Install. Before the install completes you may see a message notifying you that you'll need to upgrade the SDK plug-in.  The steps for doing this are as listed in step 13a below.

13.    You should see the final screen indicating success.  (If anything went wrong, please consult the Research In Motion (RIM) developer site.)  Click Done.



 
     
13a.  If you were instructed to upgrade the SDK plug-in after installation completed, then follow the steps you were given on the screen, which I've summarized below.  NOTE: Make sure you run Flash Builder as administrator when performing these steps:


1. In Adobe Flash Builder, choose Help > Install New Software.
2. In the Available Software section, click Add.
3. In the Add Repository section, click Local, navigate to <BlackBerry_Tablet_OS_SDK_Install_Directory>/update_site_for_FB and click OK.

4. Back in the Available Software section, select BlackBerry Tablet OS Support, and click Next.

14.    Re-open Flash Builder, open the Preferences dialog box, and again select Flash Builder > Target Platforms > BlackBerry Tablet OS. 

15.    Click the SDK Path Browse button and navigate to the folder in which  you just installed the BlackBerry Tablet SDK.  Select that folder and click Save.


 

16.    Click OK to close the dialog box.

17.    Open the Preferences dialog box once more.

18.    Select Flash Builder > Target Platforms > BlackBerry Tablet OS > Signing and click Register.


 

19.    To register with the RIM Signing Authority, you must provide the following information:

 

RDK CSJ Path:        Specify where you installed this file
PBDT CSJ Path:      Specify where you installed this file
CSJ Pin:                  Type the PIN you used when you registered to receive the CSJ  files on the BlackBerry Website.
CSK Password:       Type a password.
Confirm CSK Password:    Retype it.

Also, select the Save Password option.  If you see an option labeled Automatically Generate Development Certificate, select that as well.



20.    Click OK once you have entered this information. Flash Builder will register with RIM.

21.    You are now ready to create a certificate.  Back in the Preferences dialog box, click Create Certificate.




 
22.    In the Create Developer Certificate dialog box, fill in the required information.


 

Certificate Path: This is the path you want to store the new certificate in.  Once again, I chose to use the <Flash_Builder_Workspace>/BlackBerryDev/ folder, but I added a new subdirectory named Certs to store the certificate.  I like to keep all the BlackBerry assets in a single location.

Author:  For some reason, this setting seems to work best with no spaces.  Use your name or company name.

Keystore Password: Create a Keystore Password you will remember.  You will be prompted for this each time you use this certificate.

Save Password: Select this option.

Click OK.

23.    You are now ready to add devices.  Turn on your BlackBerry Playbook tablet and click its Settings icon (the gear icon in the upper right). 


 

24.    Within the settings screen, select Wi-Fi, ensure Wi-Fi Connectivity is enabled, and join the same network as your development machine.  In the example shown below, this is duanenet.

25.    Next, click About in the top left corner and then select Network from the drop down menu to find your IP address.  In the example shown below, it is 192.150.23.8.

 



26.    You will need to upload a debug token to the device.  Select Security on the left and click Development Mode.




27.    In the Development Mode screen, toggle Use Development Mode on, and then click Upload Debug Token. Note: When you turn Development Mode on, you'll need to set a device password if you have not already done so.  Remember the password you set, you'll need it again in Step 29.

 

28.    Back in Flash Builder, open Preferences and select Flash Builder > Target Platforms > BlackBerry Tablet OS > Test Devices.
  

29.    Click Add to add a test device. 

 



     
In the Add BlackBerry Tablet OS Test Device dialog box, enter the following information:

Device Name:   Type a descriptive name for your device.
Device IP:         Type the IP address you obtained above.
Password:         Type the password for the device.
Save password: Select this option.

30.    Click  Create A Debug Token And Upload It To This Device.   This will bring up a warning that says you have to put your device in debug token upload mode.

You've already done this in previous steps, so just click OK.  If the device times out of upload mode, you may have to repeat these steps.

     

31.    If all goes well, you should see your device listed as a Test Device. Click OK.


32.    You should also see your device indicate that the Debug Token has been installed.





   

33.    Congratulations!  You have finished the preparations for your BlackBerry tablet and Flash Builder.


If you have any problems with the steps, email me at dnickull at adobe dot com.