Supplemental files and examples for this book can be found at http://examples.oreilly.com/9780735663022-files/. Please use a standard desktop web browser to access these files, as they may not be accessible from all ereader devices.
All code files or examples referenced in the book will be available online. For physical books that ship with an accompanying disc, whenever possible, weve posted all CD/DVD content. Note that while we provide as much of the media content as we are able via free download, we are sometimes limited by licensing restrictions. Please direct any questions or concerns to .
Introduction
As far back as 1999, some smart guys predicted that mobile would become the primary focus of development in only a few years. Although it has taken a bit more time than expected, the era of mobile software has arrived at last. Why did it take so long? The answer is surprisingly simple: mobile software needed a critical mass of users to develop before it could take off. The process of accumulating mobile users probably started with the release of the first iPhone back in 2007, but today, it has reached a large enough mass to trigger all sorts of chain reactions.
Back in 1990 (yes, you read that right), Bill Gates gave a keynote talk at Comdex titled Information at Your Fingertips. Lets be honestfor 20 years, we pretended we really had information (that we needed) at our fingertips, but at most, we had that information only at handwhich makes a huge difference. Now is the time, though, that we can cover the short distance from hand to fingertips. With mobile devices everywhere, and especially with a revolutionary version of Windows on the horizon, I believe were truly entering a new era of developmenta paradigm shift.
Paradigm shifts just happenand mobile represents a big one. Mobile enables new business scenarios and new ways of doing the same business. Mobile affects nearly everybodyusers, professionals, and clearly developers. Writing mobile applications is a challenge that the vast majority of developers will face in the near future. Overall, mobile applications are simpler than desktop or web applicationsbut thats true only if you count just the number of functions. The hardest part of mobile development is to identify the right set of use-cases and the right user experience and interaction model. It turns out that the typical mobile application user is much less forgiving than the average user of web or desktop applications. As developers, we forced users to play by the rules of software for decades. In contrast, mobile developers will be forced to play by the rules of user experience and conform to user expectations. This is how software always should have been; but its definitely not how software has been built for at least the past 20 years. Moreover, before too many more years pass, mobile may well be the only software that we will be called upon to write.
The term mobile refers to a variety of platforms, each with its own set of capabilities and features, and each of which requires significantly different skills: different operating systems, different programming languages, different application programming interfaces (APIs), and even different computers. A mobile application is more sophisticated and more complex than web applications with regard to resource management, data entry, sensors, data storage, and life cycle. Furthermore, each operating system has its own set of development guidelines and a proprietary deployment model.
This book is intended as a quick-but-juicy guide to issues that you may face while developing a mobile project for one or multiple platforms. The book starts by analyzing the various types of mobile solutions, which include websites, websites optimized for mobile devices, and native mobile applications, and then identifies a few design patterns common to all mobile applications and technologies available on the various platforms. Predictive fetch, back-and-save, and guess-dont-ask are just a few of the patterns being discussed and implemented. The book puts considerable emphasis on mobile sites and frameworks, and on techniques to detect browser capabilities accurately. For example, the book offers a chapter on Wireless Universal Resource FiLe (WURFL)the framework being used by Facebook for mobile device detectionand compares that to the detection capabilities in plain ASP.NET.
Furthermore, the book offers an overview of mobile development for the three major platformsiOS, Android, and Windows Phone. In particular, this book builds the same application for all three platforms, discussing tools, frameworks, practices, and illustrating architectural and structural differences along the way. Finally, the book covers PhoneGap and HTML5-based development for mobile devices.
After reading this book, you probably wont be a super-expert in any of those platforms, but youll know enough to start producing code on any of the most popular devices. Youll also know enough to advise your customers and help them define effective mobile strategies for their business.
Who Should Read This Book
As companies start going mobile, they need a strategy long before they need a mobile site or an iPhone app. But when companies have developed the strategy and start looking into implementing it, they face the rough issue of not having or finding architects and developers that know the mobile world from a variety of angles. Today, they can easily find great iPhone or Android developers, but they can hardly find a consultant that can suggest, based on strong evidence, whether a mobile site is preferable for them.
This book is aimed at providing an architect summary of what you need to know to design and implement mobile solutions. Today, a mobile solution often means arranging the same application for several different platforms (iPhone, Android, Blackberry, and Windows Phone), and doing that using a very specific set of design patterns with little in common with desktop or web apps. Last but not least, the effort must be done in the context of the customers needs, expectations, and existing business.
Not a Mobile Developer? Not a Developer!
For a company with a consolidated business, mobile is a way to expand its horizon. The new expansion stage of mobile is reaching out to companies and enterprises and prospecting new ways of doing business. This is a paradigm shift with a deep impact that will give rise to new professional jobs, much as the web itself did more than a decade ago.
Thats why I maintain that in only a couple of years, every developer will be either a mobile developer or no developer at all. Being a mobile developer surely includes knowing iOS, Windows Phone, HTML5, and Android, and perhaps BlackBerry, possibly Bada, and even developing for smart TVsand, of course, for the mobile web. More than anything else, though, developers must acquire a mobile mindset. You can always figure out fairly easily how to play a video on iOS, or how to make an Android device vibrate. But what isnt as easy to acquire is the intrinsic nature of mobile applications and the patterns behind them, and which aspects to focus on for optimization.
Mobile is different. Overall, its simpler, but its also much less forgiving than other types of applications.
Therefore, this book is for everybody who needs to acquire some mobile development insight. The books contents wont become obsolete in just a few months because I made a serious attempt to reach and report from the heart of the mobile experience. This book discusses technology, but it is not based on any particular technology; therefore, its an introductory text for any form of mobile development.