Build Hybrid Apps using Jquery Mobile and Cordova
Apache Cordova is a set of device APIs that allow a mobile app developer to access native device function such as the camera or accelerometer from JavaScript. Combined with a UI framework such as jQuery Mobile or Sencha Touch, this allows a smartphone app to be developed with just HTML, CSS, and JavaScript.
When using the Cordova APIs, an app can be built without any native code (Java, Objective-C, etc) from the app developer. Instead, web technologies are used, and they are hosted in the app itself locally (generally not on a remote http server).
jQuery Mobile framework takes the "write less, do more" mantra to the next level: Instead of writing unique applications for each mobile device or OS, the jQuery mobile framework allows you to design a single highly-branded responsive web site or application that will work on all popular smartphone, tablet, and desktop platforms. jQuery Mobile is a HTML5-based user interface system.
Steps to build Cordova App
1. Install Cordova
on OS X and Linux:
$ sudo npm install -g cordova
on Windows:
C:\>npm install -g cordova
2. Go to the directory where you maintain your source code, and run a command such as the following:
$ cordova create hello com.example.hello HelloWorld
First argument hello specifies a directory to be generated for your project which Cordova will create. Its www subdirectory houses your application's home page, along with various resources under css, js, and img, which follow common web development file-naming conventions.
The config.xml file contains important metadata needed to generate and distribute the application.
The second argument com.example.hello provides your project with a reverse domain-style identifier.
The third argument HelloWorld provides the application's display title.
3. Add Platforms
$ cd hello
Your ability to run these commands depends on whether your machine supports each SDK, and whether you have already installed each SDK. Run any of these from a Mac:
$ cordova platform add ios
$ cordova platform add android
$ cordova platform add blackberry10
$ cordova platform add wp8
$ cordova platform add windows
$ cordova platform add android
$ cordova platform add blackberry10
Run this to check your current set of platforms:
$ cordova platforms ls
Run either of the following synonymous commands to remove a platform:
$ cordova platform remove blackberry10
$ cordova platform rm android
Running commands to add or remove platforms affects the contents of the project's platforms directory, where each specified platform appears as a subdirectory. The www source directory is reproduced within each platform's subdirectory, appearing for example in platforms/ios/www or platforms/android/assets/www.
4. Build the App
Run the following command to iteratively build the project:
$ cordova build
$ cordova build ios // platform-specific
When the cordova build command is run, the www source directory is reproduced within each platform's subdirectory, appearing for example in platforms/ios/www or platforms/android/assets/www. Because the Cordova constantly copies over files from the source www folder, you should only edit these files and not the ones located under the platforms subdirectories.
5. Add Plugin Features
Basic device information (Device API):
$ cordova plugin add org.apache.cordova.device
Use plugin ls (or plugin list, or plugin by itself) to view currently installed plugins.
$ cordova plugin ls # or 'plugin list'
To remove a plugin, refer to it by the same identifier that appears in the listing
$ cordova plugin remove org.apache.cordova.device
6. Test the App on an Emulator or Device
Load the platforms/android folder into Eclipse and make sure all dependencies are correct and run the App in either emulator or you can plug the handset into your computer and test the app directly. In case of Ios load the platforms/ios app into Xcode and run the application.
7. Production Release
$ cordova plugin rm org.apache.cordova.console
To generate a release build for Android, we can use the following cordova command:
$ cordova build --release android
To generate a release build for Ios, we can use the following cordova command:
$ cordova build ios --release --device
For Reference please check http://cordova.apache.org/docs/en/4.0.0/guide_overview_index.md.html#Overview