官术网_书友最值得收藏!

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:

  1. Download and extract Apache Ant and add it to your PATH variable.
  2. Download BlackBerry WebWorks SDK from http://na.blackberry.com/eng/developers/browserdev/widgetsdk.jsp and install to, say, C:\BBWP.
  3. Open a command window and navigate to the C:\BBWP directory.
  4. Type ant create -Dproject.path=C:\Touch\BlackBerry\WebWorks\book and press Enter.
  5. Change to the newly created directory located at C:\Touch\BlackBerry\WebWorks\book.
  6. Open the project.properties file in your favorite editor and change the line bbwp.dir= to bbwp.dir=C:\\BBWP.
  7. Copy C:\sencha-touch to the www folder.
  8. Create the ch01 folder inside www and copy ch01_01.js, which was created in the first recipe, into the ch01 folder.
  9. 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>
  10. Build the PhoneGap sample project by typing ant build in your command window while you are in your project's directory.
  11. 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
  12. 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.

主站蜘蛛池模板: 紫金县| 将乐县| 正镶白旗| 封丘县| 墨竹工卡县| 泰和县| 乌什县| 民乐县| 方山县| 远安县| 鄯善县| 托里县| 玉门市| 广平县| 保定市| 洛南县| 石河子市| 永兴县| 湘阴县| 平远县| 信丰县| 承德市| 江安县| 嘉义市| 子长县| 宣威市| 平乡县| 贵阳市| 丹巴县| 山东省| 贡嘎县| 桐梓县| 新营市| 永川市| 甘肃省| 涞水县| 绿春县| 临泽县| 翁源县| 南岸区| 林周县|