Preface

If you can’t explain it simply, you don’t understand it well enough.

Albert Einstein

The proliferation of the cellular phone has revolutionized the way we connect to the world and communicate with one another. It is the foundation of a mobile lifestyle.

Although the evolution of cell phone technology is progressing thanks to hardware manufacturers and platform engineers, the unveiling of its potential is in the hands of application creators.

Toward that end, Google and the Open Handset Alliance have developed Android, an operating system that runs on many mobile devices. Adobe and the Open Screen Project offer AIR as a development tool for various mobile systems. Both efforts bring some uniformity to this fragmented world.

This book is about developing for the Android platform using Adobe AIR. My goal is to provide in-depth information on the various topics specific to mobile development. My wish is that this book will help you create quality applications.

Audience

This book is for developers. It aims to attract enthusiast coders who are curious about both the technology and the user experience. I try to provide as much background information as possible on all topics, and not just an ActionScript reference guide.

Today is still the beginning of the mobile era, and any one of you is a potential innovator. Your contribution can influence the future of mobile technology.

Assumptions This Book Makes

This book assumes you already have basic to intermediate experience with the ActionScript 3 language. For example, you should know how to create an event listener, understand different data types, and know what a class is. If you need to learn the fundamentals of the language or get a refresher, I recommend Essential ActionScript 3.0 by Colin Moock (O’Reilly).

I introduce each topic from the ground up. I also provide code samples in snippets so that you can absorb the concept in small steps. Finally, I use pure ActionScript only, and few third-party libraries.

Contents of This Book

This book is divided into four sections:

Chapters 1 through 5 go over the technology, the environment, and the fundamentals of creating and publishing an AIR application.

Chapters 6 through 14 cover functionality-specific topics like multitouch technology, using the accelerometer, using the native camera, geolocation, audio, video, and more.

Chapters 15 through 17 cover some more advanced topics, propose an architecture to manage multiple views, and offer the code for a full application.

Chapters 18 and 19 provide suggestions on best practices for asset management and development.

In addition, this book has a companion website from which you can download code samples that you can compile and install on your mobile device.

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic

Indicates filenames, file extensions, directory paths, URLs, email addresses, and new terms where they are defined

Constant width

Indicates language and script elements, such as class names, types, namespaces, attributes, methods, variables, keywords, functions, modules, commands, properties, parameters, values, objects, events, XML and HTML tags, and similar elements

Constant width bold

Indicates commands or text to be typed by the user

Constant width italic

Indicates text that should be replaced with user-supplied values

Note

This icon signifies a tip, suggestion, or general note.

Warning

This icon indicates a warning or caution.

Note that I prefer placing curly braces on the same line of code, as I feel this makes the code easier to read in print form and does not use space unnecessarily. I also did away with the convention of private variables with an underscore for the same reason.

I introduce a new API or class in small code segments to illustrate an explanation.

Using Code Examples

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 this book 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.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Developing Android Applications with Adobe AIR by Véronique Brossier. Copyright 2011 Véronique Brossier, 978-1-44939-482-0.”

If you feel your use of code examples falls outside fair use or the permission given here, feel free to contact us at .

We’d Like to Hear from You

Please address comments and questions concerning this book to the publisher:

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)
(707) 829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at:

http://www.oreilly.com/catalog/9781449394820

To comment or ask technical questions about this book, send email to:

For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com.

Find us on Facebook: http://facebook.com/oreilly

Follow us on Twitter: http://twitter.com/oreillymedia

Watch us on YouTube: http://www.youtube.com/oreillymedia

Safari® Books Online

Note

Safari Books Online is an on-demand digital library that lets you easily search over 7,500 technology and creative reference books and videos to find the answers you need quickly.

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, 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.

Acknowledgments

Thank you to Arno Gourdol, Director of Engineering, Flash Runtime Foundation, and to the AIR team for their hard work and responsiveness during the prerelease of this product (in particular, Mohit Arora, Syed Mohd Mehadi, Romil Mittal, and Ashutosh Jagdish Sharma). I would like to express my appreciation to Joe Ward, who did a stellar job of providing answers and documentation on all aspects of the technology.

I would like to acknowledge all my fellow developers on the AIR for Android prerelease list, in particular, Jyunpei Furukawa and Pascal Sahuc.

Thanks to O’Reilly editor Mary Treseler, copyeditor Audrey Doyle, production editor Kristen Borg, and illustrator Robert Romano. Thank you to the O’Reilly technical reviewers: Tom Barker, Rich Tretola, Matthew David, Chris Griffith, and a special thank to Kevin Bahadoor.

In addition to the O’Reilly technical editors, I asked friends and professional acquaintances to review parts of this book. They each read a single chapter based on their expertise; several generous souls reviewed more than one.

Thank you to Francois Balmelle, David Cameron, Danny Durra, Renaun Erickson, Judah Frangipane, Ben Garney, Colin Holgate, Alexandre Houdent, Kevin Hoyt, Lisa Larson-Kelley, Elliot Mebane, Doug McCune, André Michelle, Keith Peters, Brian Rinaldi, Michael Thornburgh, and Edwin Van Rijkom.

Thank you to Grant Garrett for letting me use the Influxis services to test my video applications, to Jonathan Bryski for the walk cycle drawing, and to Pier Borra at MTVNetworks for the sabbatical to jumpstart the writing process.

Merci to Thibault Imbert for his contagious enthusiasm when I first considered writing a book. Thank you to Rich Shupe for sharing his experience as an author and his great sense of humor.

I would like to express my gratitude to Mike Chambers and Colin Moock for helping me at some point along the way in an industry where being a woman often means being invisible.

Thank you to Satyen Mehta, my partner, for his patience and great support (he addresses me as The Jacqueline Cousteau of Flash), and for cooking me many delicious meals while I was writing.

CMB’s gentle presence and entertaining behavior released a lot of my stress while I was working at night. I am sorry that a Mesocricetus auratus didn’t make the cover of this book.

Get Developing Android Applications with Adobe AIR now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.