Why Aren’t You Using PhoneGap?

PhoneGap (now becoming known as the Apache Cordova project) is commonly thought of as a cross-platform mobile development solution. While true, I think it’s best to think of PhoneGap as modernzr for the mobile web.

The W3 is working on standards for web sites to be able to access specific hardware features. These common hardware features were first prominent in mobile, but are coming back to laptops via tablets and hybrids. Feature examples are GPS, Camera, Motion Sensors, Network Sensors. Also, mobile has popularized the idea of system maintained contact lists and other information that is now available (with proper permissions) to all apps.

The runtime in your application is a native app which hosts a native browser control, and that browser control is pointed at a local directory you include in the app with html. And the javascript has access to some os specific features that are exposed to javascript.

When those standards are in place, mobile web sites will be able to fulfill most of the promise of native applications. This is why Steve Jobs didn’t want to build an app store in the beginning, and both RIM and Microsoft have been pushing html/css as 1st class ways for building apps.

In this new world with device access standards, only special circumstances like intense 3d graphics should require native code in a c-like language.

But this isn’t the world. Those standards aren’t in place. So PhoneGap fills that gap (any guesses about the name?). And it has the added benefit of supporting the app store distribution model, where mobile web apps require the user to bookmark the page to their homescreen.

Most cross-platform apps get knocked for performance reasons. Sure PhoneGap apps are html and javascript, but javascript engines are improving a lot these days, and you can always use plugins to push key pieces of your application into the native arena. Plugins in PhoneGap allow you to write native code (ie Objective-C on iOS) that is exposed to the javascript in your application.

Also, cross platform frameworks are usually criticized for their look and feel. In PhoneGap, you’re using html and css, a platform that we’ve been working to style for a very long time (in tech terms). I think this fact explains some of the reasons that companies like facebook and linkedin use html heavily in their frameworks.

If you’re interested in getting started in PhoneGap, I recently reviewed a book I recommend to get started. It’s a couple versions back now, but it covers things conceptually well, and it’s a nice companion to the docs.

Not every application is a fit for PhoneGap. There are reasons to go native. But I think that for basic data goes in / data comes out type of applications, It’s a great way to start. And getting good at writing single page style apps with heavy javascript will push you in the direction the web is already going.