What is PhoneGap?

March 18, 2011

Update: I've never advocated the use of PhoneGap over native SDKs for creating mobile apps. In my experience, native apps are superior in many ways. That said, there are some limited use cases for using HTML and bridged JavaScript for user interface elements in native apps.


I just explained PhoneGap to a client wanting an iPhone app. I thought the explanation was good enough to share. If you're trying to wrap your head around it, I hope this helps...

PhoneGap lets developers use web technologies to develop an iPhone app. Apple has a web browser object developers can use to display HTML content. Usually developers use it to display HTML from a remote web server. What PhoneGap does is let developers create their user interface using HTML in the web browser object instead of the built-in user interface objects (buttons, lists, text fields, etc).

Normally, this would be very limiting, since web browsers can't access most of the services a smartphone provides - what PhoneGap does is "bridge the gap" (hence the name) between the smartphone and the web browser by exposing smartphone services using JavaScript.

For developers that don't have experience with a smartphone's native development tools, using PhoneGap lets them leverage their knowledge of HTML and JavaScript to make an app. PhoneGap also makes it easier to support multiple smartphone platforms because much of the HTML and JavaScript can be reused between platforms which have this web browser object. (iPhone, Android, the newest Blackberry phones, and Palm webOS phones).

To clarify further, the HTML and JavaScript you put into a the web browser object in a PhoneGap app isn't served by a web server over the Internet - it is embedded into the app. That doesn't mean your app is forever limited to what is put into it when it ships - just as they would otherwise, the developer integrates the PhoneGap screens with your remote data sources (typically via JSON web services) - in this case the PhoneGap screens are like templates. If changes to the template are needed, the developer updates them and submits an updated app to the App Store. This is no different than for apps that don't use PhoneGap - any changes to apps must be re-submitted to the App Store before they can appear on people's phones.