Cordova: Getting Started with iOS and Android Applications (Tech Tip #14)

cordova-logo

Apache Cordova is a platform for building native mobile applications using HTML, CSS, and JavaScript. This blog will show how to build a simple application using Cordova and run it on iPhone and Android emulators.

Complete detailed instructions are available here. Lets get started!

  1. Install Node Package Manager (optional): The easiest way to get started with Cordova is using the cordova command-line interface. This tool allows you to create new projects, build them on different platforms, and run them within an emulator. You can also use the CLI to initialize project code, after which you use various platforms’ SDKs to develop them further.The command-line is available as Node.js packaged module and can be installed using npm. If you already have Node.js then you already have npm, otherwise download and install Node.js.
  2. Install cordova command-line as:
  3. Create a new project as:
  4. Target platforms: Specify a set of target platforms such as iOS or Android. But before these target platforms can be specified the machine needs to support the SDK and the corresponding SDK must be installed.For example, XCode must be installed to specify iOS as the target platform, and Android SDK for Android target platform. Once installed, the target platform can be added as:

    And verify as:
  5. Build the app as:
  6. Simulator: Install the iOS simulator
  7. Test the app on iOS simulator:

    to see the result as:

    tt15-ios-simulator-default-screen

  8. Add Android target platform as:

    You’ll need to make sure bin directory from Apache Ant and android command from Android SDK are in the path.

  9. Create Android Vitual Device
    1. Generate the list of targets:

    2. Create Android Virtual Device as:

      Note that the target value is chosen from previous command’s output.

  10. Test the app on Android emulator:

    to see the result as:

    tt15-android-simulator-default-screen

Most of the steps above like installing emulators, XCode, Android SDK are one time. But other than that the application development process is pretty straightforward.

How cool ?

There are several ways to get help: mailing lists, file an issue, docs, @apachecordova.

JBoss Tools provide great tooling for Cordova. Check out this two-part video that provide an end-to-end application development using Cordova

and

Future blogs will continue building upon this application and show integration with other technologies, add other features like accelerometer, compass, geolocation, battery events, camer, media, vibration, etc.

Be Sociable, Share!

9 thoughts on “Cordova: Getting Started with iOS and Android Applications (Tech Tip #14)

  1. Wow this tip helped me to develop my first corodova android app.
    I tried with windows8 os, all the commands listed in this tip are working fine.

  2. Pingback: Ada Bolda

Leave a Reply

Your email address will not be published. Required fields are marked *


eight + 5 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">