Replace with a graphic 5.5” Tall & 4.3” Wide Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe condential. 1 Developing for Android with the Flash Platform Mihai Corlan Platform Evangelist, Adobe gotoAndSki(), June 2010
White Master
Replace with a graphic
5.5” Tall & 4.3” Wide
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 1
Developing for Android with the Flash Platform
Mihai Corlan Platform Evangelist, Adobe
gotoAndSki(), June 2010
®
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 2
What Android phones?
Flash Player 10.1 runs only on Android 2.2 or newer
Adobe AIR runs on Android 2.1 and 2.2
Phones: Motorala Droid, HTC Desire, Google Nexus One (ARMv7 processor)
®
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 3
API’s & Features
Multi-Touch Works on Desktop for both Flash Player 10.1 and AIR
On Android works only in AIR
System.Capabilities.TouchScreenType (!nger, none)
Mobile text input If no physical keyboard then the virtual one is bring on for text input !elds
Accelerometer input Accelerometer class allows developer to read acceleration values on X,Y, and Z axes
Accelerometer.isSupported
"ash.events.StatusEvent
"ash.events.AccelerometerEvent (UPDATE)
®
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 4
API’s and Features
Screen Orientation Stage object dispatches a StageOrientationEvent object when the orientation of the screen
containing the stage changes
stage.orientation
StageOrientationEvent.ORIENTATION_CHANGING
StageOrientationEvent.ORIENTATION_CHANGE
Camera and Mic access don’t work on mobile
Geolocation Geolocation class
geoLocation.addEventListener(GeolocationEvent.UPDATE, handleLocationRequest);
GeolocationEvent properties: latitude, longitude, altitude, heading, speed, H&V accuracy, timestamp
®
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 5
API’s and Features
Listening for Hardware bu"ons (Back, Menu, Search) Keyboard.MOBILE_BACK_KEY
Keyboard.MOBILE_MENU_KEY
Keyboard.MOBILE_SEARCH_KEY
Focused Mode (single tap)
Smartzoom (double tap)
Full-Screen AS-only stage.displayState = StageDisplayState.FULL_SCREEN;
®
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 6
API’s and Features
Integration with the device Phone, Messaging, Email, Browser:
navigateToURL(new URLRequest("tel:” + “00407668”));
navigateToURL(new URLRequest("sms:” + “00407668”);
navigateToURL(new URLRequest("mailto:"+ “[email protected]”))
navigateToURL(new URLRequest(“h#p://corlan.org”));
®
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 7
Optimizations
Smart Rendering Flash content that’s not visible to the user will not be rendered and will receive limited CPU
time
Sleep Mode #e player will be put to sleep along with the device to conserve power
Out-of-Memory Management “click-to-play” bu"on that the user can control as necessary
®
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 8
What languages/frameworks
For browser you should stick to ActionScript projects. While Flex 4 works in browser, you might not get the performance you are looking for
For AIR I found Flex 4 framework could be a good choice. Test for your speci!c use case because your mileage could vary
A number of people created light-weight components for mobile development: h"p://dgrigg.com/post.cfm/04/28/2010/Alpha-Release-of-Skinnable-Minimal-Components
h"p://blog.kevinhoyt.org/?p=548
®
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 9
Android SDK
You have to download the Android SDK
#is offers the command line tools necessary for installing/uninstalling APK !les, displaying the Console, screen capturing and so on
h"p://developer.android.com/sdk/
®
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 10
Download Flash Player 10.1 and AIR runtime/SDK
h"p://labs.adobe.com AIR 2.5 Runtime Device (Éclair / FroYo) (APK !les)
AIR 2.5 SDK Windows / Mac / Linux
®
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 11
Installing APK !les to your Android
Connect your phone to your computer using the USB cable
Navigate to Android SDK/tools/ folder and run adb command:
adb devices
#is command should list your device
Run this command to install APK !les:
adb install Runtime_Device_Froyo_20100517.apk
®
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 12
Tools for developing AIR apps for Android
Flash CS 5. You can install a plug-in for Android
®
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 13
Tools for developing AIR apps for Android
Flash Builder 4
Download AIR SDK 2.5 for your OS
Create an AIR app
If you use Flex, change the root node from WindowedApplication to Application
Application descriptor !le: <application xmlns="h!p://ns.adobe.com/air/application/2.5">
<supportedPro!les>mobileDevice</supportedPro!les>
®
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 14
Deploying from Flash Builder 4
You can use Serge Jespers’s Package Assistant Pro h"p://www.webkitchen.be/package-assistant-pro/
Can package your project as an APK !le
#en you can use “adb install appname.apk” command
®
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 15
Deploying from Flash Builder 4
Or you can create a script (sh / bat) that grabs the !les from bin-debug, package them as an APK !le, uninstall the app from the phone, install the new app
rm -f install.apk
/Users/mcorlan/Desktop/Android/android-sdk-mac_86/tools/adb uninstall app.aTabSpli"erSkunkwork
java -jar /Users/mcorlan/Desktop/Android/adt.jar -package -target apk -storetype pkcs12 -keystore /Users/mcorlan/Desktop/Android/mcorlan2.pfx -storepass 12cor13 install.apk main-app.xml main.swf
/Users/mcorlan/Desktop/Android/android-sdk-mac_86/tools/adb install -r install.apk
®
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 16
Seeing the Android console
Connect your Android Phone
Enable debugging on device
Open a terminal window and execute this command: adb logcat
You’ll see all the traces and exceptions in the console
®
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 17
Device Central CS5
You can use Device Central CS 5 for testing your Flash Application
Doesn’t support AIR
You publish from Flash CS5 your application
In Device Central you add a Nexus One pro!le and load the SWF
#en you can use the emulator for testing the app on the phone, including the accelerometer, keyboard
®
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 18
Resources
Gotoandlearn.com – tutorial on installing the Android SDK, AIR runtime, and AIR extension for Flash CS5
h"p://www.webkitchen.be/package-assistant-pro/
h"p://%ashmobileblog.com
h"p://corlan.org
White Master
Replace with a graphic
5.5” Tall & 4.3” Wide
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 19
Q & A
#ank You!
h"p://corlan.org
Twi"er: mcorlan
®
Copyright 2010 Adobe Systems Incorporated. All rights reserved. Adobe con!dential. 20
Packaging & Pricing – Available for purchase March 22, 2010
Flash Builder 4 Standard
$249 / $99 €175 / €69
Y30000 / Y12000
Flash Builder 4 Premium
$699 / $299 €519 / €229
Y85000 / Y36000
Adds profilers, network monitor, unit testing harness and integration, command-line build
Includes ColdFusion Builder
ColdFusion Builder
$299 €215
Y34000
Standalone or included in Flash Builder 4 Premium
Standalone or included in ColdFusion Builder
Free for Education Free for Education Includes Flash Builder 4 Standard