Phone Gap

PhoneGap (http://phonegap.com/) is an open source framework for building native mobile applications using HTML, CSS, and Javascript for iPhone, Android, BlackBerry, Palm webOS, and Symbian WRT (Nokia). PhoneGap is a perfect for transforming a mobile web application to a native application. It is easy to use for web developers. In order to use PhoneGap, a web developer will need to learn how to build using one or more device SDKs and tools, but all the application code can be HTML, CSS, and JavaScript. In fact, a developer must be fairly expert in JavaScript to take advantage of this platform. Depending on the perspective of the developer, it is a benefit or a drawback that it provides little in the way of design patterns for mobile applications. It will not help you with an application that works off-line, which means it is possible on Android and iPhone with Webkit's Web Storage support,1 but not on BlackBerry (as of this writing).

PhoneGap provides a rich collection of client-side JavaScript APIs with a method for hosting your web application within a native mobile application. PhoneGap is a sponsored project of Nitobi (http://nitobi.com), a software consultancy headquartered in Vancouver BC. The framework started in 2008, and is free to use under an MIT license.

The key advantage of creating a native mobile application with PhoneGap is that you can drop in a mobile web application and build it into a native application that an end user may install (or purchase). As a native application, it can access certain capabilities not available from a web application, such as access to contacts data, geolocation, camera, and accelerometer using PhoneGap's JavaScript APIs.

To create a native application with PhoneGap, you start by writing a mobile web application using HTML, CSS, and Javascript using whatever tools you are most comfortable with. PhoneGap does not require your application to conform to any

1 The Web Storage spec is still in working draft (and now considered separate from HTML 5 by the World Wide Web Consortium (W3C). It has been implemented already by many browsers including Android and iPhone mobile WebKit browsers. For more information, see: http://dev.w3.org/html5/webstorage/.

particular structure, nor does it provide any specific guidance about how to create your app. If you already have an existing mobile web application, you may be able to easily convert it to use in PhoneGap. PhoneGap works particularly well on such platforms as iPhone and Android that include the WebKit browser with the advanced JavaScript and CSS of HTML 5.

In fact, PhoneGap tracks advanced features of HTML 5 and the work of standards bodies such as the W3C Device API Group (http://www.w3.org/2009/dap/) that defines standards for Javascript APIs for mobile phone features. PhoneGap attempts to implement emerging APIs to interact with device services such as contacts, camera, and so forth today and make them available as part of its framework ahead of these APIs being available in mobile browsers. The goal of PhoneGap is to cease to exist once mobile browsers expose these APIs. A selling point of PhoneGap is that you are not coding to a proprietary API but instead to what may in the future turn out to be W3C standards.

An express goal of the PhoneGap project is for the project to not exist. We believe in the web and devices should too. The web is moving off the desktop and into the pockets of people all over the world. Phones are the new window to the internet and, currently, they are second class. PhoneGap aims to move your device to a nice first class window. With a foot rest. Maybe a pillow.

Note that while PhoneGap attempts to be a non-proprietary API and tracks standards from W3C, those standards are not fully developed. PhoneGap exists to bridge the gap between the standard and what is required to build a real application, so it contains APIs that diverge from the standard. This is also perhaps a reason why the PhoneGap APIs change frequently.

PhoneGap is well-suited for anything you could do with a mobile web application. Like all of the cross-platform frameworks that leverage the browser for UI, it is not well-suited for applications that require intense math calculations or 3-D animations. Neither is it well-suited for developers needing to write data-driven applications, like most enterprise applications, that must work offline using sync'd local data. PhoneGap does not provide specific database support and relies on HTML5 database APIs for persistence, which are not widely available.

The key benefit of being able to package and distribute your mobile web application is that you have a marketplace for your application, such as the Apple App Store, Nokia's OV Store, or Blackberry App World. Your application will then have screen real-estate wherever the phone installs applications and users can typically configure their phone to display the application for quick access.

When running inside PhoneGap, your application can access certain devices capabilities from JavaScript that are not otherwise available to web apps. The PhoneGap API provides access to the following device capabilities:

Making Games For the iPad

Making Games For the iPad

Making an iPad game doesn't have to be something that only developers do. You too can create a game that will help to entertain the user and it will help to make you money. With Making Games for the iPad, you don't have to be a computer genius, but you will certainly feel like one.

Get My Free Ebook


Post a comment