PhoneGap or Cordova?
PhoneGap was originally developed by Nitobi, which was later purchased by Adobe Systems. Adobe contributed the PhoneGap code to Apache Software Foundation, starting a new project named Apache Cordova. Cordova is open source software. PhoneGap can be considered a distribution of Cordova, extending the open source project with extra features.
Probably the most important extra feature is provided by the site https://build.phonegap.com. With this service you can build your project remotely to any supported platforms. Otherwise if you build locally you have to install the development framework of the target platform (and it's not so easy because you can only bulid Windows Phone 8 applications on Windows 8 OS, and for iOS you have to use Mac OS-X).
Right now I'll build my application locally for Android. I'll investigate the cloud service and remote build later in another post.
To start the development process you have to install some tools. After choosing "Install PhoneGap" on the front page, you can see that you have to install NodeJS first. It's quite simple on Windwos platform, there is an msi installer on the http://nodejs.org/ front page.
After installing NodeJS start a command window and navigate to the NodeJS folder (C:\Program Files\nodejs by default). To install PhoneGap, run this command:
npm install -g phonegap
To install Cordova CLI (Comman Line Interface), run:
npm install -g cordova
Check the system path, it should contain both NodeJS and PhoneGap install paths:
(Path modifications don't affect windows that are already open so you should start a new command window.)
If everything is in place after typing phonegap you should see something like this:
Check the system variables and set JAVA_HOME to the JDK install folder (create the variable if it doesn't exist).
We have to include sdk\tools and sdk\platform-tools sub-folders from Android SDK install folder.
We also need apache ant to build our PhoneGap projects:
Create first application
Connect your Android phone to the computer and run the following commands:
phonegap create hello cd hello phonegap run android
We should see the following on the screen:
You can find the source code of the sample project in the www subfolder.