O'Reilly book has a great PhoneGap tutorial

The draft of a new O’Reilly book titled iPhone Apps with HTML, CSS, and JavaScript is in the works.

Chapter 7, titled “Going Native” contains a wonderful introduction to PhoneGap. This is an excellent starting point for those of you interested in using PhoneGap or simply understanding what PhoneGap is.

PhoneGap thoughts

I’ve been trying to figure out PhoneGap for about a week now and I’m just now starting to understand it because the documentation is sparse.

This is my understanding:

A PhoneGap application is a iphone safari window without the UI stuff: no bookmark bar, no scroll bar, nothing. Just a plain white canvas.

The iphone UI stuff that you see in a PhoneGap application are not really cocoa. It is HTML, javascript, css, and webkit special features (animations) cobbled together to look like a native iphone cocoa app. You could make it look like a regular web page if you wanted to. You have the option to do standalone (offline) apps or web-based apps.

I am finding that the best starting point is to look at apple’s safari dev center to get access to the special features that safari has for the iphone like HTML5 support and the CSS3 animations.

The phonegap js library provides hooks into iphone-specific functions like touch, accelerometer, and GPS. If you do not need that functionality you do not need to use the js files.

As far as I can tell the best thing to do is make a web app first then point your phonegap application to it using the configuration file (Settings.plist). Your phonegap app is essentially a safari window that depends on your HTML and CSS to provide all of the UI because this is a safari pane, it has no navigation or address bar, or anything.

You make a regular web site but it can have access to special iPhone features using the javascript library (phonegap.js) they provide. Other stuff like SQLite support is built into safari.

Look at the Apple Safari Dev center ( to figure out the interesting things that Safari can do. Do not bother looking at iphone dev, your phonegap app is really a Mobile Safari app.

The examples they have are kind of confusing because some of the stuff looks like native cocoa applications. It is not native cocoa, they are using HTML, CSS and Javascript to make stuff that looks exactly like a cocoa app but it’s actually a web page. What amazes me is a guy was able to make that blocks game in HTML and Javascript.

Learning PhoneGap on iPhone

I’ve been wanting to create an iPhone application for the last few months but I haven’t had the time or the intellect to figure out Objective C. However, I do know a little HTML, javaScript, and other web application related languages.

Enter PhoneGap. PhoneGap is an abstraction layer that allows you to port web applications to be iPhone, Android, and Blackberry native applications with JavaScript and HTML. These web applications can either require connectivity or be standalone applications.

The documentation for PhoneGap is limited and incomplete. I hope to document my experiences with PhoneGap here, so that we can learn how to use PhoneGap together.

The wiki has some simple tutorials but they don’t fully explain how it all works. Building a self-contained Application is the best example I found so far. I hope to add more info here as I learn more about the system.

Syndicate content