Setting up the Blackberry-based development environment
So far, we have seen how to set up the environments for Android and iOS development. This recipe walks us through the steps required to set up the environment for Blackberry-based development.
Getting ready
JDK is installed and the following environment variables are set correctly:
JAVA_HOME
PATH
How to do it...
Carry out the following steps:
- Download and extract Apache Ant and add it to your
PATH
variable. - Download BlackBerry WebWorks SDK from http://na.blackberry.com/eng/developers/browserdev/widgetsdk.jsp and install to, say,
C:\BBWP
. - Open a command window and navigate to the
C:\BBWP
directory. - Type
ant create -Dproject.path=C:\Touch\BlackBerry\WebWorks\book
and press Enter. - Change to the newly created directory located at
C:\Touch\BlackBerry\WebWorks\book
. - Open the
project.properties
file in your favorite editor and change the linebbwp.dir=
tobbwp.dir=C:\\BBWP
. - Copy
C:\sencha-touch
to thewww
folder. - Create the
ch01
folder insidewww
and copych01_01.js
, which was created in the first recipe, into thech01
folder. - Edit
index.html
and past the following code:<!DOCTYPE HTML> <html> <head> <title>Yapps! - Your daily applications!</title> <link rel="stylesheet" href="sencha-touch/resources/css/sencha-touch.css" type="text/css"> <script type="text/javascript" charset="utf-8" src="phonegap.1.0.0.js"></script> <script type="text/javascript" charset="utf-8" src="sencha-touch/sencha-touch-debug.js"></script> <script type="text/javascript" charset="utf-8" src="ch01/ch01_01.js"></script> </head> <body></body> </html>
- Build the PhoneGap sample project by typing
ant build
in your command window while you are in your project's directory. - Deploy to Simulator:
- While in your project directory, in command prompt, type
ant load-simulator
- Press the BlackBerry button on the simulator, go to downloads and you should see your app loaded there
- While in your project directory, in command prompt, type
- Deploy to Device:
- You have to have your signing keys from RIM
- While in your project directory, in the command prompt, type
ant load-device
- Press the BlackBerry button on the simulator, go to downloads and you should see your app loaded there
How it works...
In steps 1 and 2, we downloaded and installed the Blackberry SDK and PhoneGap required for Blackberry-based development.
In steps 3 through 6, we created a PhoneGap-based project for Blackberry.
In steps 7 through 9, we prepared the www
folder by creating and copying our application specific folders and files.
In step 10, we built the project. In addition, we modified index.html
to make it look exactly like the one created in the Setting up the Android-based development environment recipe.
In steps 11 and 12, we deployed and tested the application in the simulator, as well as in the real Blackberry device.
See also
The recipe named Setting up the Android-based development environment in this chapter.