Thanks to mobile phones, we have moved from virtually no one having access to information to virtually everyone having access to the vast resources of the Web. This is arguably the most important achievement of our generation. Despite its overarching importance, mobile computing is in its infancy. Technical, financial, and political forces have created platform fragmentation like never before, and it’s going to get worse before it gets better.
Developers who need to engage large and diverse groups of people are faced with a seemingly impossible challenge: “How do we implement our mobile vision in a way that is feasible, affordable, and reaches the greatest number of participants?” In many cases, the answer is web technologies. The combination of advances in HTML5 and mobile devices has created an environment in which even novice developers can build mobile apps that improve people’s lives on a global scale.
Google’s Android operating system is a compelling addition to the mobile computing space. In true Google fashion, the platform is open, free, and highly interoperable. The development tools are full-featured and powerful, if a bit geeky, and run on a variety of platforms.
I’m the first to admit that not all apps are a good fit for development with web technologies. That said, I see a lot of apps written with native code that could have just as easily been done with HTML. When speaking to developers who aren’t sure which approach to take, I say this:
Using open source, standards-based web technologies gives you the greatest flexibility, the broadest reach, and the lowest cost. You can easily release it as a web app, then debug and test it under load with thousands of real users. Once you are ready to rock, you can use PhoneGap to convert your web app to a native Android app, add a few device-specific features if you like, and submit to the Android Market—or offer it for download from your website. Sounds good, right?
This book avoids the Android SDK wherever possible. All you need to follow along with the vast majority of examples is a text editor and the most recent version of Google Chrome (a cutting-edge web browser that’s available for both Mac and Windows at http://www.google.com/chrome). You do need to have the Android SDK for the PhoneGap material in Chapter 7, where I explain how to convert your web app into a native app that you can submit to the Android Market.
Constant width bold
Constant width italic
This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.
If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at email@example.com.
With a subscription, you can read any page and watch any video from our library online. Read books on your cell phone and mobile devices. Access new titles before they are available for print, and get exclusive access to manuscripts in development and post feedback for the authors. Copy and paste code samples, organize your favorites, download chapters, bookmark key sections, create notes, print out pages, and benefit from tons of other time-saving features.
O’Reilly Media has uploaded this book to the Safari Books Online service. To have full digital access to this book and others on similar topics from O’Reilly and other publishers, sign up for free at http://my.safaribooksonline.com.
|O’Reilly Media, Inc.|
|1005 Gravenstein Highway North|
|Sebastopol, CA 95472|
|800-998-9938 (in the United States or Canada)|
|707-829-0515 (international or local)|
Writing a book is a team effort. My heartfelt thanks go out to the following people for their generous contributions.
Tim O’Reilly, Brian Jepson, and the rest of the gang at ORM for making the experience of writing this book so rewarding and educational.
David Kaneda for his wonderfully obsessive pursuit of beauty. Whether it’s a bit of code or a user interface animation, he can’t sleep until it’s perfect, and I love that.
The gang at Nitobi for creating and continuing to support PhoneGap.
Brian Fling for broadening my view of mobile beyond just the latest and greatest hardware. Brian knows mobile from back in the day; he’s a wonderful writer, and on top of that, a very generous guy.
PPK, John Gruber, John Allsopp, and John Resig for their contributions to and support of the underlying technologies that made this book possible.
Joe Bowser, Brian LeRoux, Sara Czyzewicz, and the swarm of folks who generously posted comments and questions on the OFPS site for this book. Your feedback was very helpful and much appreciated.
My wonderful family, friends, and clients for being understanding and supportive while I was chained to the keyboard.
And finally, Erica. You make everything possible. I love you!