Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Creating BlackBerry 10 AIR Applications with FlashDevelop

by Retired on ‎07-29-2013 11:03 AM (3,578 Views)

flashDevelopLogo.png

If FlashDevelop is your IDE of choice for Adobe® AIR® development, this guide will show you how to get started deploying AIR applications on BlackBerry® 10.

 

Contents

 

  • Pre-FlashDevelop Setup
  • Setting up a BlackBerry 10 AIR project in FlashDevelop
  • Testing using the Simulator
  • Testing using a physical device
  • Using the BlackBerry SDK for Adobe AIR and AIR Native Extensions
  • Packaging an application for release
  • Additional help

 

Pre-FlashDevelop Setup

 

1. Make sure that you have the latest BlackBerry SDK for Adobe AIR installed. The default location this will install to on windows is:

x64 - C:\Program Files (x86)\Research In Motion\blackberry-tablet-sdk-3.X.X

x86 - C:\Program Files\Research In Motion\blackberry-tablet-sdk-3.X.X

 

2. Add the bin folder of the BlackBerry 10 AIR SDK to your windows path.

- Right click Computer icon on desktop and select Properties

- Click Change settings

- Click the Advanced tab

- Click Environment Variables

- In System variables scroll down to Path variable and select edit, add a semicolon to the end of the string and enter the path to the BlackBerry AIR SDK bin folder. For example: C:\Program Files (x86)\Research In Motion\blackberry-tablet-sdk-3.X.X\bin

preSetup1.png

 

3. To sign and package your application you must register for free signing keys.  After registering you will receive 2 files in 2 separate emails.

 

4. If you don’t have a physical BlackBerry 10 device download the latest simulator and install it.

 

5. Download the BlackBerry 10 FlashDevelop template and copy the contents of the zip file to the Projects folder where you installed FlashDevelop.

The default location for the FlashDevelop Projects folder is:

X64 - C:\Program Files (x86)\FlashDevelop\Projects

X86 - C:\Program Files\FlashDevelop\Projects

 

6. BlackBerry 10.0 and BlackBerry 10.1 use the AIR 3.1 SDK and BlackBerry 10.2 uses the AIR 3.5 SDK. The project template assumes you will be developing for BlackBerry 10.2 and use AIR 3.5. You will need to make sure that you download the AIR 3.5 SDK from the Adobe AIR archive. Extract this .zip file and place it in a convenient location. You will be pointing to this SDK in the next section.

 

 

Setting up a BlackBerry 10 AIR project in FlashDevelop

 

1. Create a new project by clicking on Project -> New Project. Under ActionScript 3 select AIR Mobile AS3 App BB10. Enter a name for your project and click the Ok button.

setup1.png

 

2a. Create a BlackBerry certificate if you don’t have one. You only need to do this once! Expand the bat directory in the Project pane and open the bat\CreateCertificateBlackBerry.bat file. Enter the following variables into the .bat file:

 

RDK_LOCATION: The full path of the file you get in an email after registering for signing keys.

PBDT_LOCATION: The full path of the file you get in an email after registering for signing keys.

CSJ_PIN: This is the PIN you set in the online form when registering for signing keys.

STORE_PASS: This is a new password that you're going to create and use for signing apps.

 

setup2.png

 

2b. After filling in the variables in step 2 right click on the bat\CreateCertificateBlackBerry.bat file and select Execute to create you developer certificate. Once created, your developer certificate can be found here - C:\Users\[USER-NAME]\AppData\Local\Research In Motion

setup3.png

 

3. Make sure that your project is pointing to the AIR 3.5 SDK.

Click Project -> Properties

Click on the SDK tab.

Click Manage.

Click on the Installed Flex SDKs row and then the […] button that appears.

setup4.png

 

Click Add and enter the path to the AIR 3.5 SDK that you downloaded in the first section.

setup5.png

 

Verify that you’re using the AIR 3.5 SDK.

setup6.png

 

 

Testing using the Simulator

 

1. Open the simulator and note the IP address in the bottom left corner.

simulator1.png

 

2. We’ll need to make sure that we target the simulator when deploying our application. Open the bat\SetupApplication.bat file and change the DEVICE_IP variable to the address we just noted.

simulator2.png

 

3. Next, we’ll change our target to a BlackBerry debug release. Open the Run.bat and comment out the goto desktop target and uncomment the goto blackberry-debug target.

simulator3.png

 

4. You should now be able to build your project. Pressing F8 will build your project and F5 will deploy your project to the simulator. Below is what the command will look like if you’re successful. You will also see a white screen on the simulator. (Sometimes the FlashDevelop debugger is unable to connect to the simulator. I have found that restarting my machine has resolved the issue).

simulator4.png

 

 

Testing using a physical device

 

1. We’ll need to make sure that we target the device IP when deploying our application. Open the bat\SetupApplication.bat file and if you’ve connected your device via USB make sure that the DEVICE_IP variable is 169.254.0.1.

 

2. Enable development mode on the device. Go to Settings -> Security and Privacy -> Development Mode and toggle development mode on. If you don’t have a password set on your device you will need to create one.

 

3. Back in flash builder navigate to the bat\CreateDebugToken.bat file, right click on it and select the Execute option. This will create a debug token and upload it to your device. Keep this window open for the next step.

device1.png

device2.png

 

4. Add your author and authorId to the bar-descriptor.xml file to permit debugging on the device. Uncomment those fields in the bar-descriptor.xml file and copy over the correct information from the debug command dialog from the previous step.

device4.png

 

5. Next, we’ll change our target to a BlackBerry debug release. Open the Run.bat and comment out the goto desktop target and uncomment the goto blackberry-debug target.

simulator3.png

 

6. You should now be able to build your project. Pressing F8 will build your project and F5 will deploy your project to the device. Below is what the command will look like if you’re successful. You will also see a white screen on the simulator. (Sometimes the FlashDevelop debugger is unable to connect to the simulator. I have found that restarting my machine has resolved the issue).

device3.png

 

 

Using the BlackBerry SDK for Adobe AIR and AIR Native Extensions

 

To take advantage of using the BlackBerry SDK for Adobe AIR API’s you will need to import some libraries into your project. The files you will need can be found in the BlackBerry SDK for AIR’s installation directory. While not all of these files will be needed for every project below is a list of files that are available to import, the default location on x64 systems and how to import them. You can either reference these files in the folders they are in or copy them over to the lib folder of your project.

 

Once you’ve imported them right click on the library and select Options. Make sure that they match what is referenced below.

sdk1.png

 

SWC Files:

 

blackberry.swc
C:\Program Files (x86)\Research In Motion\blackberry-tablet-sdk-3.X.X\frameworks\libs\blackberry
Included library

qnx-air.swc
C:\Program Files (x86)\Research In Motion\blackberry-tablet-sdk-3.X.X\frameworks\libs\air
External library

qnxmedia.swc
C:\Program Files (x86)\Research In Motion\blackberry-tablet-sdk-3.X.X\frameworks\libs\qnx
Included library

qnxui.swc
C:\Program Files (x86)\Research In Motion\blackberry-tablet-sdk-3.X.X\frameworks\libs\qnx
Included library

 

ANE Files:

 

BlackBerryPushService.ane
C:\Program Files (x86)\Research In Motion\blackberry-tablet-sdk-3.X.X\frameworks\libs\blackberry\ane
External library

QNXDevice.ane
C:\Program Files (x86)\Research In Motion\blackberry-tablet-sdk-3.X.X\frameworks\libs\qnx\ane
External library

QNXNetwork.ane
C:\Program Files (x86)\Research In Motion\blackberry-tablet-sdk-3.X.X\frameworks\libs\qnx\ane
External library

QNXSensors.ane
C:\Program Files (x86)\Research In Motion\blackberry-tablet-sdk-3.X.X\frameworks\libs\qnx\ane
External library

QNXSkins.ane
C:\Program Files (x86)\Research In Motion\blackberry-tablet-sdk-3.X.X\frameworks\libs\qnx\ane
External library

 

 

Packaging an application for release

 

1. Open SetupApplication.bat and ensure that the STORE_PASS variable is correctly set to your store password and that the DEVICE_IP variable is set to the IP of the device you’ll be testing on.

 

2. Set the mode to Release at the top of Flash Builder and in Run.bat uncomment goto blackberry-package and ensure that all of the other goto statements are commented out.

package1.png

 

3. You should now be able to build your project. Pressing F8 will build your project and F5 will deploy your fully signed project. Below is what the command will look like if you’re successful.

package2.png

 

Your compiled .bar file will be located in the root of your project. You can take this now and upload it to the vendor portal. Vendor portal accounts are free and all of the setup information can be found on there.

 

 

Additional help

 

If you would like to make changes to any of the commands provided all of the documentation for the command line arguments being used can be found on BlackBerry SDK for Adobe AIR documentation microsite.

 

All of the BlackBerry AIR SDK documentation can be found in the API reference section on the microsite.

 

You can target various BlackBerry devices by changing the resolution in the Run.bat file. For more information on device resolution and aspect ratios on BlackBerry 10 please read this blog post.

 

If you’re stuck with any of the steps above the best place to go for help is the BlackBerry AIR forum

Contributors
Users Online
Currently online: 4 members 1,704 guests
Please welcome our newest community members: