Chapter 3. Getting Started with PhoneGap

PhoneGap is an open source collection of build scripts and native wrappers for multiple mobile platforms. PhoneGap generates a native executable from your app for each platform it supports. This native executable is code which can actually be installed on a real device as a native app. The end users will never know that you coded it in JavaScript rather than Objective C or whatever the native SDK uses. For iOS devices it will be an Objective C Xcode project. For Android it will be an Android stub app written in Java. For webOS the apps are mostly HTML already so PhoneGap provides a simple make file to assemble the app. On each platform the native wrapper will open an embedded HTML renderer (usually called a web view) to run the rest of your app.

PhoneGap also provides a set of consistent JavaScript hooks to native APIs like the accelerometer, camera, and GPS. These are APIs which typically aren’t available when running as a web page loaded from the Internet. PhoneGap wraps the native APIs to provide a consistent cross-device platform for you to code against. This means you can access device features while only having to write your app once.

PhoneGap is an open source project started by the team at Nitobi, hosted at http://phonegap.com/. During the writing of this book Adobe began to use PhoneGap as a component in some of their tools, then eventually bought the Nitobi company and transferred official ownership of PhoneGap to Apache. The transition ...

Get Building Mobile Applications with Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.