I have recently been developing an application for IOS using phonegap. I was extremely fascinated by the simplicity of its usage. In this post, I will guide through a step-by-step procedure to setup phone gap on a Debian system.
Setting Up PhoneGap application on a local system
You will come across the term Cordova often when one talks about PhoneGap. Please note that for most purposes, both are essentially interchangeable. Here, I will give instructions to setup cordova on a Linux Debian system. You can make appropriate modifications for your operating system.
The first step is to install the latest version of cordova on your system. The installation using the Command-Line Interface is extremely straight forward.
1) Install NodeJS on your system from their website.
2) Run the following to install cordova
sudo npm install -g cordova
3) Once cordova is installed, now create a new project. To do that run the following command
sudo cordova create photoFilter com.photoFilter.filter photoFilter
Note: I am calling my example application as photoFilter.
This will create folder called photoFilter in the current directory. The important files to note here are the config.xml file and the www folder. The config.xml file is where you will mention the plugins you are going to use, the various permissions needed for the application, etc. The www folder is the root folder for your HTML, CSS and JS files. If you read the phonegap features, the key feature that lets you develop applications quickly is that you can use web technologies to create a web application. Hence, the entire development of the application will happen using HTML, CSS and JS.
4) We will now add the required platforms on which we wish to deploy the phonegap application on. In this example, I am going to run this application on an android device. Hence, I will just add the android platform. Note, you need to install the android SDK from the android site before performing this step. I will assume that the required SDK is installed on your system.
cd photoFilter cordova platform add android
Note: The common error while running this command is that your Android SDK may not be set in the PATH variable. Set the appropriate paths and re-try this command. You will now have a folder called android within the platforms folder of your application.
You are now all set to start development of the application.