With the ongoing explosion of the mobile Android operating system and proliferation of Android powered devices in the smart phone and tablet computing markets, this is the perfect time to explore the world of Android development using the Flash Platform. Adobe recently released statistics announcing that by the end of 2011, it is projected that more than 200 million smartphones and tablets will support Adobe AIR applications. For 2011, the company expects the mobile Flash Player to be supported on more than 132 million units worldwide. This book provides a variety of fundamental recipes exploring common needs of the mobile Android developer when utilizing these Flash Platform runtimes.
Many existing Flash application developers are excited with the prospect of building mobile applications for Android devices, but where to begin? Expand your reach into mobile application development by using this text as a guide. When possible, the recipes in this book are written using pure ActionScript 3, allowing the reader to work through each example in the tool of their choice. In some instances, we demonstrate the power and flexibility of the mobile Flex framework when dealing with specific layout and structural needs. Jump-start your experience with mobile Android through the step-by-step examples found within.
Flash Development for Android Cookbook will demonstrate a wide variety of mobile-specific examples specifically conceived to be direct and useful in the development of applications for Android devices. Everything you need to get started is included along with suggestions to further your experience with Flash, Flex, and AIR when developing mobile Android applications.
Topics covered within this book include development environment configuration, mobile project creation and conversion, the use of touch and gestures, responding to changes in location and device movement in 3D space, the capture, generation, and manipulation of images, video and audio, application layout and structure, tapping into native processes and hardware, and the manipulation of the file system and managing local application databases. The book will also cover things such as Android-specific device permissions, application optimization techniques, and the packaging and distribution options available on the mobile Android platform.
Chapter 1, Getting Ready to Work with Android: Development Environment and Project Setup, demonstrates the configuration of a number of development environments and tools which can be used in developing Flash content for mobile Android.
Chapter 2, Interaction Experience: Multitouch, Gestures, and Other Input, informs the reader with a variety of unique touch and gesture interactions that can be used across Flash Platform runtimes.
Chapter 3, Movement through Space: Accelerometer and Geolocation Sensors, empowers your applications with the ability to pinpoint a user's precise geographic location and even determine local changes in device shift and tilt through the on-board accelerometer.
Chapter 4, Visual and Audio Input: Camera and Microphone Access, discusses how to capture still images, video, and audio from integrated device hardware through both Flash based capture methods and while employing native camera applications.
Chapter 5, Rich Media Presentation: Working with Images, Video, and Audio, takes a look at a variety of media presentation mechanisms available to us on the Flash Platform including playback of progressive and streaming video, the use of Pixel Bender shaders, and even audio generation.
Chapter 6, Structural Adaptation: Handling Device Layout and Scaling, discusses a variety of methods we can use to gain detailed information regarding device displays, and the usage of this data when sizing and positioning visual elements along with structured layout through the mobile Flex framework.
Chapter 7, Native Interaction: Stage WebView and URI Handlers, demonstrates methods of utilizing native applications such as the Web browser, e-mail, SMS, Telephone, and Maps as extensions of our Flash based experience.
Chapter 8, Abundant Access: File System and Local Database, provides the readers with details of the steps necessary to access, open and write to file streams on the device storage, create and manage local SQLite databases, and preserve application state upon application interruption.
Chapter 9, Manifest Assurance: Security and Android Permissions, demonstrates the various Android Manifest permissions and provides examples of Market filtering, encrypted database support, and other security-minded techniques.
Chapter 10, Avoiding Problems: Debugging and Resource Considerations, looks at ways in which a developer can streamline the efficiency of an application by tapping into the device GPU, handling user interaction in responsible ways, and memory management techniques.
Chapter 11, Final Considerations: Application Compilation and Distribution, advises the reader on project preparation, code signing, release compilation, and distribution through the global Android Market.
To make use of the recipes included in this book, you need access to software for developing Android applications with the Flash Platform. We recommend using Adobe Flash Builder 4.5, Adobe Flash Professional CS5.5, or PowerFlasher FDT 4.2 and above. These Integrated Development Environments are preferred because of their specific support of a mobile Android workflow, but you may actually use any application you prefer to write code that will be compiled for AIR for Android and deployed to mobile devices.
You will, however, need access to the following (if not using these particular IDEs):
Adobe AIR SDK—for compiling your Flash applications to .APK for Android
Flex 4.5 SDK—if you want to take advantage of the mobile Flex framework
The Adobe AIR SDK is included with both Flash Professional CS5.5 and Flash Builder 4.5. The Flex 4.5 SDK is included with Flash Builder 4.5. If using alternative software to develop Flash based Android applications, these SDKs can be downloaded freely from the Adobe open source website.
You will also want to be sure to have access to a device running Android 2.2 or above with AIR for Android 2.5 or above installed for demonstrating the recipes, and testing your own applications.
This book contains recipes covering a variety of topics from the very simple, to those which are more advanced. If you are a seasoned Flash developer, this book will get you quickly up to speed with what is possible with Android. For those who are new to Flash, welcome to the world of visual rich, rapid application development for mobile Android devices! If you have any interest in Flash development for Android, this book has you covered.
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: "Create a new file called recipe1.py
to put all of this recipe's code."
A block of code is set as follows:
streamClient = new Object(); streamClient.onBWDone = onTextData; streamClient.onTextData = onTextData; streamClient.onMetaData = onMetaData; streamClient.onCuePoint = onCuePoint;
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "There are many choices of IDE (Integrated Development Environment) for developing Flash platform projects for Android devices".
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>
, and mention the book title via the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail <[email protected]>
.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]>
if you are having a problem with any aspect of the book, and we will do our best to address it.