What is PhoneGap? edit

PhoneGap allows programmers to build applications for Android and other mobile devices in JavaScript, HTML5, and CSS3. PhoneGap (also called Apache Cordova) is open source software.

Getting started with PhoneGap for Android on MacOSX edit

  • brew update
  • brew install node
  • npm install -g cordova

Getting started with PhoneGap for Android on Windows edit


To do:
describe the "new" approach that uses Android Studio, as described in recent documentation, rather than the "old" approach that uses Eclipse.

... npm install -g cordova ...


As of cordova-android@4.0.0, Apache Cordova has switched to Android Studio and Gradle, and switched away from Eclipse and Ant.

Following the Phonegap documention,[3][4]

These first few steps set up the standard Java development environment for Android:

  • Download and install Eclipse Classic
  • Download and install Android SDK
  • Download and install the ADT plugin

The next steps add Apache Cordova, setting up a standard JavaScript HTML CSS development environment for Android:

  • Download the latest copy of Cordova and extract its contents.
  • Setup your PATH environment variable

Plugins edit

Many plugins have been developed for PhoneGap.[5][6]

One popular plugin is the Barcode plugin.

Barcode plugin edit

(This section describes how to scan a barcode inside a PhoneGap app. An alternate approach scans a barcode from a normal HTML/JavaScript Web page.[7])

Several people use the Barcode plugin to work with barcodes in their PhoneGap application.[8][9][10][11][12][13]

The standard PhoneGap barcode plugin is often all an Android application needs. If it doesn't yet support the barcode format you want to use, you may need to build your own custom PhoneGap plugin, perhaps starting with Barcode development in Java.[14]

Updating old PhoneGap code edit

Sometimes old functions of PhoneGap are deprecated, and later removed from PhoneGap. Here's a few tips for application writers who want to update old code to work with the latest version of PhoneGap:

Follow the steps in the PhoneGap Upgrading Guides: "PhoneGap Upgrading Guides" Various other tweaks: "PhoneGap Android Plugins: Sometimes We Screw Up" "Updating PhoneGap"

import org.apache.cordova.api

public class InAppBillingPlugin extends CordovaPlugin {


Further reading edit