Flash Mobile: Developing Android and iOS Applications

Flash Mobile: Developing Android and iOS Applications

by Matthew David

View All Available Formats & Editions

Google's open source Android OS is predicted to become a market leader in smartphone operating systems in the next few years - with Apple's iPhone units substantially below it in share. Android application development is booming- the marketplace surpassed 100,000 apps and 1 billion downloads in July. The iPhone initiated the rush to develop smartphone applications,


Google's open source Android OS is predicted to become a market leader in smartphone operating systems in the next few years - with Apple's iPhone units substantially below it in share. Android application development is booming- the marketplace surpassed 100,000 apps and 1 billion downloads in July. The iPhone initiated the rush to develop smartphone applications, but Apple's refusal to permit Adobe Flash leaves the millions of Flash designers to concentrate their mobile application development efforts on the Android. Developing Android Applications with Flash is in the vanguard of this new development with a fully illustrated primer to Android development using Flash CS5. Readers learn all of the essentials - from setting up their development environment to Android optimization techniques - all with the aid of practical tutorial lessons that deliver hands-on training.

Product Details

Taylor & Francis
Publication date:
Visualizing the Web Series
Product dimensions:
7.40(w) x 9.60(h) x 0.90(d)

Read an Excerpt



Focal Press

Copyright © 2011 Elsevier Inc.
All right reserved.

ISBN: 978-0-240-81569-5

Chapter One


Today, there are 5 billion people around the world using mobile phones. It is a staggering figure. No other technology is advancing at the rapid speed the mobile industry is experiencing. As a frame of reference, there are only 1.7 billion PCs being used around the world.

A new category of mobile phone is rapidly growing: the smart phone (Figure 1.1). Three years ago, a smart phone allowed you to send e-mail. Today, when you think smart phone, you think e-mail, web, games, MMS, video conferencing—you think of a computer in your pocket.

There are a number of companies leading the next wave of smart phone market. Google, Apple, RIM, Nokia, Microsoft, and HP (with Palm) all have their own operating systems and hardware. It seems almost every three to six months these companies leapfrog each other. Consider this—at the end of 2009, a mobile phone running at 500 MHz with a 3 MB camera was considered screaming fast. Now, you can pick up those same phones for less than $100. It you want something faster you go for 1 GHz with a 1 GB of RAM, an 8 MP camera, front and rear facing cameras, proximity devices up the wazoo, and sophisticated operating systems (OS) that rival, and in some cases exceed, what you can accomplish on your desktop. And in 2011, companies that make the ultra-efficient system-on-chip designs used in mobile phones such as Qualcomm's Snapdragon are headed to 2 GHz with multicore infrastructures housing accelerated GPUs, CPUs, and a ton of RAM.

This is not a mobile phone in your pocket. It is a screamingly fast computer.

With this all said, the smart phone market is still very small. You can take all the iPhones, Android phones (Figure 1.2), and BlackBerrys and you will have less than 300 million devices worldwide. With a global figure of 5 billion mobile users, it is clear that the smart phone market has massive potential for growth.

So, what does it mean to develop for a smart phone? At the end of the day, there are essentially two ways you can develop for a smart phone:

• Develop directly to the software development kit (SDK)

• Develop using an intermediate technology

Each mobile device comes with an SDK that you can use for development. An SDK comes with the development tools, bundling tools, and emulators you need to test your code. When you need access to the latest and greatest technology, you need to use an SDK.

The challenge you have with using core SDKs is that you need to use the native development language. This is different for each SDK. For instance, Apple prefers you use Objective-C whereas Google prefers you use Java.

The second way to develop mobile devices is to use an intermediate technology that allows you to build for multiple devices using only one language. An example of this is the 3D game development technology called Unity 3D. Unity uses JavaScript to let you to script your games and then converts the JavaScript into code that will allow you to build iPhone, Android, and Windows Desktop applications. The downside to using intermediate technologies is that you are dependent on the development company to update their tools to the latest SDKs and technologies. This can be hard work as the SDKs are frequently updated. For instance, Apple has updated its iOS operating system four times in three years, and Google's Android has been updated five times in less than two years.

With that said, it is much easier to develop using intermediate languages. You can leverage skills you already have without having to go through the learning curve of adopting a new language.

In May 2010 at the Google I/O conference, Adobe announced that it would be bringing both the Flash Player and AIR (Adobe Integrated Runtime) to Google's Android 2.2. This is really big news for Flash developers for several reasons:

1. The version of Flash coming to the Android is the latest 10.1 version, not some crippled alternative.

2. AIR gives you an immediate in-road into mobile device development, leveraging the tools and knowledge you already have.

3. Flash is coming to 19 other mobile device companies.

4. Android runs on tablets and TVs as well as phones.

The Flash Player that is now available for all Android 2.2 users, shown in Figure 1.3, is very efficient. There has been a lot of noise from companies such as Apple stating that Flash is a battery hog and will kill your phone's CPU. Is this true? The reality is that it is not. Tests have been conducted showing that the Flash Player on mobile devices is highly efficient and does not cause the CPU-crippling results Apple is stating. The Flash Player works inside the browser in Android. You trigger the use of the Flash Player by tapping on the Flash content in the web page. For instance, you can view a Hulu.com video by tapping on the content in the page.

Adobe's modification of AIR for mobile devices was the really big story at Google's I/O. AIR is a very powerful, mobile technology. It reaches for the same goals that Java set in the 1990s: write once, run anywhere. Unlike Java, AIR really achieves its goal. AIR apps are built in the Flash Professional development environment using Flash technologies you are already used to, such as ActionScript to program your solutions, MPEG video for video, and the same animation techniques you have been using for years.

Adobe's support for Flash on mobile devices will be coming to 19 other mobile development companies. This means that the techniques you learn in this book will be applicable beyond just Android. Other entities that will be adopting Adobe's technologies include RIM's BlackBerry, Nokia, HP/Palm WebOS, and Microsoft's Windows Phones Series 7. Notably absent is Apple, Inc. The year 2010 will go down as the year that Apple drew a line in the sand and said very publicly, "We will not support Adobe's Flash." It is a shame that Apple has made this stance, since Apple's iOS is a very important part of the mobile market. Let's hope it changes its mind.

Earlier I mentioned how rapidly the mobile market is growing. Today, that market is predominantly composed of phones; but there are additional tools joining this market. During 2010, Apple released the massively popular iPad, a tablet computer that is very mobile and very light. Not to be outdone, rival companies, such as Nvidia, Samsung, Dell, and Cisco, are also coming out with their own tablets. The devices range in size from 5 inches all the way up to 11 inches and beyond. What they all share is that they are running Android as their OS. They come prepackaged with support for Flash.

Another device that is coming out of the mobile world is Google TV. At its essence, Google TV is really a modified version of Android that runs directly on your TV. And, yes, your Flash apps will run here, too. Last year you could run your Flash applications only on Windows and Mac computers. Today you can add smart phones, tablets, and TVs. Your Flash can literally go with you wherever you want to go.

It is not all roses, of course. To get your Flash apps running in AIR on all these new devices, Adobe did choose to make one big change: You must develop your solutions using ActionScript 3.0 (AS3). AS3 has been around since 2006. If you have not made the jump to AS3, then I will help you as we step through this book. You can no longer leverage the older AS1 and AS2 scripts that you have been using for years. Time to start fresh.

The first section of the book explains how a Flash designer can set up a Flash CS5 environment to publish Android apps. Later you will step through the process of downloading, installing, and running the Android SDK, necessary for your development. By the end of this section you will have created your first Android application using Flash CS5. At the end of this book you will have the knowledge to build almost any type of Flash-based application for the Android OS 2.2 and greater. How cool is that?

So, let's get started.

Designing and Developing for Android Hardware

Before we get involved with setting up your design and development environment, let's take a little time to review how you should approach developing applications that run on an Android device. There are a number of design considerations you always want to keep in the back of your mind as you work on your apps. They are:

• Different hardware

• Hardware acceleration

• Touch interaction

An Android phone is simply very different than a desktop, and you need to develop your app to take advantage of these differences.

Working with Android Hardware

The Android platform has been available for less than two years. In that time it has gone from being available on a few phones to being installed on dozens of different phones available on almost every mobile carrier. Today there are over 50 different mobile phones running Android OS 1.5 and greater. Flash is supported on all phones that run Android 2.2. Table 1.1 gives you a list of the Android phones that currently support Flash and AIR. The table is broken down by manufacturer, name of the phone, screen display (where available), and additional notes about the phone.

You can see from the devices listed in Table 1.1 that there is a broad range of hardware specifications for Android phones.

The number one hardware difference you will need to keep in mind is screen size. The default screen size for Android development is 320 x 480 ppi (points per inch) but, as you can see from the list, this is not always the case. Screen resolutions range from 240 x 320 for the HTC Wildfire all the way up to 854 x 480 for the Motorola Droid X. How do you design apps for this broad range? The trick comes in how you use Flash to do the work for you. We will be getting into that in more detail as you work your way through the book. Just keep in mind that not all Android phones are created equal.

In addition to screen size, the second feature that you will find different from one device to another is RAM and CPU. The more RAM you have determines how much data can be crunched with active apps. The multitasking feature in Android allows for six core apps to be running simultaneously. But you may have many more utilities running. To run more applications will require more RAM. Current smart phones have 256 MB of RAM, with others having as much as 1 GB of RAM. Future devices will have RAM levels that rival desktop computers. For now, however, develop applications that carefully manage the amount of RAM you use.

The CPU listed earlier is slightly misleading. Almost all smart phones are developed with a system-on-chip design (SOC). An SOC merges the CPU, GPU, RAM, and other systems into one chip. This architecture is typically built on ARM CPUs. The ARM architecture is highly energy efficient, allowing mobile phone batteries to last longer. Intel, Nvidia, and AMD are also starting to join the ultra-efficient mobile chip market. At first, the original Setting up FlASh CS5 For Android development 11 SOCs in the 2007/2008 smart phone market were very slow compared to a PC. Today, however, it is common to have a 1 GHz CPU/SOC with 2 GHz multicore SOCs shipping 2011. For a good Flash/AIR experience you need to be running a 1 GHz CPU/SOC architecture. The Motorola Droid runs at 500 MHz, and can run Flash, but you are better off testing with an HT Evo, Nexus One, or Motorola Droid X, all of which run at 1 GHz or faster.

Android Hardware Acceleration

Phones come loaded with technology in the hardware. This is awesome for you as a developer. Following are some key hardware technologies that you will want to keep in mind as you develop for the Android OS:

• Touch-sensitive screen

• Sound/microphone

• Vibration

• Camera


• Accelerometer/compass

The touch-sensitive screen seems like an obvious hardware feature, but it is your main input to your device and you use your finger. More on that in a moment.

Every Android phone supports audio, both to listen through speakers and to record with a microphone. We will cover audio in more detail later in the book, but you will want to keep your audio files in MP3 and WAV format. Unlike desktop computers, where you cannot guarantee if there is a microphone installed by the manufacturer, you can guarantee that there is a mic on every Android device. Why? It's a phone! You need one to speak through when you make calls.


Excerpted from FLASH MOBILE by MATTHEW DAVID Copyright © 2011 by Elsevier Inc. . Excerpted by permission of Focal Press. All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.
Excerpts are provided by Dial-A-Book Inc. solely for the personal use of visitors to this web site.

Meet the Author

Matthew David is a specialist developing rich Web solutions using technologies like Flash and the latest Web design techniques. In addition, he works in online sales, marketing, and search engine optimization, with the aim of driving business to customer sites. Matthew partners with many companies as a business strategist, works closely with the World Wide Web Consortium Group (W3C), and is on Adobe's Advisory team.

Customer Reviews

Average Review:

Write a Review

and post it to your social network


Most Helpful Customer Reviews

See all customer reviews >