Book Image

Sencha Touch Cookbook

By : Ajit Kumar
Book Image

Sencha Touch Cookbook

By: Ajit Kumar

Overview of this book

Sencha touch is a versatile HTML5-based framework for developing mobile web apps that look and feel native on touch screen devices, and with it you can write your code once and deploy it to both iOS and Android saving you both time and money. The Sencha touch cookbook has a comprehensive selection of recipes covering everything from installation right through to HTML5 geo location. The Sencha Touch Cookbook really is your one stop resource for cross platform HTML5 application development. It covers the basics such as setting up an iOS and Android development environment right through to much more complex development issues such as touch gestures, animation, rich media and geo location. Every recipe is practically focused. Maximum action. Minimum theory.
Table of Contents (17 chapters)
Sencha Touch Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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.