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!
  • Tweet

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

  1. Hey Arun,
    Do you know that JBoss Tools and JBoss Developer Studio provide some good plugins for development of Cordova applications in Eclipse IDE ?

  2. Pingback: Ubuntu 下建立 Cordova 的 Android 環境… | Gea-Suan Lin's BLOG
  3. 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.

  4. Pingback: Cordova: Getting Started with iOS and Android Applications (Tech Tip #14) | Miles to go 2.0 … - appgong
  5. Cookies don’t work for authentication in Cordova Android.

    http://stackoverflow.com/questions/23471256/not-getting-cookies-in-android-phonegap-application

    Do you know of any solution or workaround ?

  6. Pingback: Ada Bolda
  7. Existem alguma forma de instalar um simular IOS no windows para usar o Cordova?

  8. There any way to install an IOS simulate the windows to use the Cordova?

  9. I have read the post and it is very much helpful because I have got to know about the Android tips and tricks which has helped me a lot in using the android applications.

  10. Ios and Android is the best operating system for mobile. I am getting good information about latest mobile operating. Thanks for sharing the good information.

  11. Android is the most popular operating system for mobile. You can also use Ios for mobile. for more information about mobile operating system please read the above post.

Leave a Reply

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