Thursday, February 27, 2014

Mobile Application Development with PhoneGap/Cordova

PhoneGap allows you to create native mobile application with the help of  HTML5, css, JavaScript.

Cordova is the core of PhoneGap and licensed by Apache. PhoneGap is now managed by Adobe. Although cordova provides some extra features but for now we are using PhoneGap.

First download node.js to install PhoneGap. After installing node.js, type following command:

npm install -g phonegap

This will download necessary files from internet, once installed you are ready to build your phonegap application. Type following to create a project:

phonegap create VizDroid com.vs4vijay.vizdroid

Here I have given my application name VizDroid, and a unique package name should be provided. In our case I have specified the package name "com.vs4vijay.vizdroid".

This will create a dummy project, go to VizDroid folder and check www folder. This www folder is the actual html serving directory. Change index.html according to you and we are ready to build mobile executable.

In this demo, I am going to create Android executable (apk file).
Make sure you have installed Androd SDK and added sdk path to PATH environment variable.

Once you do, type following to add platform and build apk.

phonegap build android

This will generate android folder in platform directory. The you copy VizDroid-debug.apk file from /bin directory. This is the executable file for android. You can run this on your device or Emulator (Genymotion, BlueStacks, Android Emulator).