Book review: PhoneGap Beginner’s Guide, by Andrew Lunny

PhoneGap Beginner’s Guide, by Andrew Lunny

Packt Publishing,

I’m reading the PDF version of this book, which displayed very nicely on Adobe Reader.

This book covers a lot of material (emphasis on “a lot”). This review will cover the breadth of this book’s content. It starts you at the beginning, with downloading PhoneGap and the Software Development Kits (SDKs) you’ll need to create and install applications for each of the mobile phone frameworks (Xcode for iPhone, Eclipse for Android, and Blackberry Webworks). We are introduced immediately to Git, ant, and Ruby, so we can start using them in our workflow.

The author encourages us to build our apps in a WebKit-compatible browser like Safari or Chrome and use their debugging tools. We get to sample their use with simple scripts so we can experience these tools ourselves. So far, these few pages have shown me several sloppy habits I’ve developed when making apps, and given me the steps to correct myself. I’m not a Javascript programmer, so some of this was all new to me.

We are guided to building our first simple app (on each platform, no less) with an Javascript alert, then on to local storage to help us persist the information the user enters. Complete code is given to show us how simple this storage is. (You can download all the book’s code from the Packt web site.) We get a sample of mustache.js, which is a view template, and displays the information in our local storage in the places we want the information to appear.

All that in the first three chapters. With humor. The chuckle train keeps on rolling as we integrate Twitter (retrieving those feeds containing our key words) and JSON to the app.

With the above foundation out of the way, the author tackles cross-platform headaches, introducing tools that help us to format our code for the different mobile phones. (You’ll want to actually follow the author along as he builds the apps, for you’ll modify those apps later on in the book.)

Next, we learn of XUI and HTML5’s video, audio, and canvas elements, CSS3 transforms, and iScroll. All this is well and good, but we want to learn about PhoneGap and it’s unique ability to access the physical phone’s capabilities. The book doesn’t disappoint: that’s next. The foregoing has given us good practices for programming for PhoneGap. The first half of the book’s blurb sums it up: “Build cross-platform mobile applications with the PhoneGap open source development framework.”

We learn how to query the device’s geolocation to get a user’s latitude and longitude (we build a postcard app and include this information with the postcard), and monitor the accelerator reading to detect device motion (shaking the device will undo the postcard).

Then we learn about using the camera, rendering the images right on our page, then finding and adding Contacts.

The author does not neglect PhoneGap plugins. We are treated to the ins and outs of getting the ChildBrowser plugin to work. (This plugin allows one to click on an external link in our app, then navigate back to our app, rather than exit the app to view the link on Safari.) We even get to write our first PhoneGap plugin!

Chapter 11 tells us about synching offline, caching online database data locally for offline usage. There, we’re introduced to Ruby and Sinatra to code web services.

I appreciated the helpful summaries of just what happened in that chapter. Those sections allow us to catch our breaths before taking the plunge in the next part. We also get pop quizzes, so we can test whether we’ve been paying attention (the answers are in the back of the book).

This book helped me to clean up my act by showing me a pro workflow. It also gave me confidence to experiment with integrating more of the PhoneGap iOS device functionality into my apps, which I have yet to do.

You’ll find the book at, Amazon (, and Safari Books Online (

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s