HTML and CSS Reference
Mobilizing Games with PhoneGap
Nowadays it seems that everyone is making, planning to make, or thinking of making
applications for mobile devices. Mobile is the next great (or maybe actually the current)
place to make money by selling applications. The Apple iPhone is currently one of the
most popular personal communication devices, and the iTunes Store gives budding
application developers a place to show and sell the fruits of their labor. Apple separates
their application-development platforms into three categories: Desktop (OS X),
Browser (Safari), and iPhone/iPad/iPod Touch (iOS).
Most iOS applications, especially games, are written in Objective-C and compiled di-
rectly to the platform using the Xcode IDE. This is a large barrier to entry to develop
native applications, as Objective-C is not widely used on platforms other than Apple
devices. Up until early 2010, Objective-C/Xcode was the only viable development sys-
tem for targeting iOS development.
In this chapter, we will “port” our HTML5 Canvas application to the iPhone using a
technology called PhoneGap. PhoneGap allows an HTML application to run natively
on an iPhone by packaging the application as a Safari Mobile “app.” This app can be
run from the iPhone interface, and it will look and act like an app compiled in Objective-
C. Applications packaged with PhoneGap can even be sold in the iTunes Store.
Other third-party tools can be used to create iOS applications and
development platform that can target iOS. In addition, there are tools
such as Ansca's Corona SDK ( http://www.anscamobile.com/ ) that use
scripting languages to harness the power of the platform.