Developing Android Applications with Adobe AIR

Book description

Put your ActionScript 3 skills to work building mobile apps. This book shows you how to develop native applications for Android-based smartphones and tablets from the ground up, using Adobe AIR. You learn the entire development process hands-on, from coding specific functions to options for getting your app published.

Start by building a sample app with step-by-step instructions, using either Flash Professional or Flash Builder. Then learn how to use ActionScript libraries for typical device features, such as the camera and the accelerometer. This book includes ready-to-run example code and a case study that demonstrates how to bring all of the elements together into a full-scale working app.

  • Create functionality and content that works on multiple Android devices
  • Choose from several data storage options
  • Create view and navigation components, including a back button
  • Get tips for designing user experience with touch and gestures
  • Build a location-aware app, or one that makes use of motion
  • Explore ways to use audio, video, and photos in your application
  • Learn best practices for asset management and development

Publisher resources

View/Submit Errata

Table of contents

  1. Dedication
  2. A Note Regarding Supplemental Files
  3. Foreword
  4. Preface
    1. Audience
    2. Assumptions This Book Makes
    3. Contents of This Book
    4. Conventions Used in This Book
    5. Using Code Examples
    6. We’d Like to Hear from You
    7. Safari® Books Online
    8. Acknowledgments
  5. 1. AIR
    1. Installing the Adobe Development Tools
      1. Flash Professional CS5.5
      2. Flash Builder 4.5
    2. Installing the AIR Runtime on an Android Device
    3. What Is in the AIR SDK
    4. New ActionScript Libraries
      1. Functionalities Not Yet Supported
    5. AIR on the Desktop Versus AIR on Android
    6. Mobile Flash Player 10.1 Versus AIR 2.6 on Android
  6. 2. Call Me, Text Me
    1. Setting Up Your Device
    2. Creating a Project
      1. Using Flash Professional
      2. Using Flash Builder
    3. Creating the Application Descriptor
      1. Using Flash Professional
      2. Using Flash Builder
    4. Writing the Code
      1. Using Flash Professional
      2. Using Flash Builder
    5. Packaging Your Application As an APK File and Installing It on the Device
      1. Using Flash Professional
      2. Using Flash Builder
    6. Testing and Debugging
      1. Using Flash Professional
      2. Using Flash Builder
    7. Mobile Utility Applications
      1. Launchpad
      2. Device Central CS5
      3. Package Assistant Pro
      4. De MonsterDebugger
    8. Installing AIR on an Android Device via a Server
    9. Other Tools
    10. Conclusion
  7. 3. Android
    1. Android Software Development Kit
      1. Installing the Android SDK
      2. Installing the Android Debug Bridge
      3. Detecting Your Device
      4. Using the Dalvik Debug Monitor
      5. Using the logcat Command
        1. Accessing the device’s filesystem
      6. Using the Virtual Device Manager and Emulator
    2. How Does AIR Run on Android?
      1. Starting AIR with intent
      2. AIR Access to Android APIs
    3. Using the Command-Line Tool
      1. A Basic Review
        1. The PATH environment variable
    4. Conclusion
  8. 4. Permissions, Certificates, and Installation
    1. Why Mobile?
    2. The APK File
      1. Creating the Application Icon
      2. Choosing the Application Settings
      3. Setting Permissions
      4. Packaging External Resources
      5. Signing Your Application with a Certificate
      6. Versioning
    3. Registering As an Android Developer
    4. Publishing an Application on the Android Market
      1. Uploading Assets
      2. Listing Details
      3. Publishing Options
      4. Distributing Applications via Adobe InMarket
      5. Publishing for the Amazon Market
    5. Controlling Distribution by Using the MAC Address
    6. Launching an AIR Application
    7. Monetizing Your Application
      1. Paid Applications
      2. Mobile Ads
    8. Reporting
    9. Conclusion
  9. 5. Evaluating Device Capabilities and Handling Multiple Devices
    1. Hardware
      1. The Processor
      2. Memory and Storage
      3. The Camera
      4. Sensors
      5. The Battery
      6. The Display
    2. Software
      1. Performance
      2. Capabilities
      3. Orientation
    3. Creating Content for Multiple Screens
      1. Asset Scaling and Positioning
        1. Dynamic positioning
      2. Vector Graphics or Bitmaps?
        1. Using vector graphics
        2. Using bitmaps
      3. Developing a Deployment Strategy
      4. Considering Connectivity
    4. Conclusion
  10. 6. Opening and Closing an Application and Saving Data
    1. The AIR Application
      1. Opening the Application
      2. Closing the Application
      3. Moving Between the Background and Foreground
      4. Setting Back, Menu, and Search Buttons
      5. Overriding a Dimmed Screen
    2. Why and How to Save Data
      1. Internal or External Storage?
      2. Local SharedObject
      3. The Filesystem
        1. Writing data to the file
        2. Reading a file
        3. Deleting a file
        4. Choosing between synchronous and asynchronous mode
        5. Writing data and saving it to temporary files
      4. Using the SQLite Database
        1. Creating the database file
        2. Opening the database file
        3. Creating the table
        4. Adding data
        5. Requesting data
        6. Editing existing data
      5. Embedding a Database
      6. Using Encrypted Local Storage
    3. Conclusion
  11. 7. Multitouch Technology
    1. A Brief History
    2. What Is Multitouch and Gesture?
      1. How Does It Work?
    3. The Multitouch Class
    4. The GestureEvent Class
      1. The Zoom Gesture
      2. The Rotate Gesture
      3. The Pan Gesture
      4. The Swipe Gesture
      5. The Press and Tap Gesture
      6. The Two-Finger Tap Gesture
    5. The TouchEvent Class
    6. The GestureWorks Library
    7. Designing for Touch
    8. Conclusion
  12. 8. Accelerometer
    1. What Is a Motion Sensor?
      1. The Accelerometer Class
      2. Visualizing the Values
      3. A Simple Animation
      4. Updates and Screen Rendering
      5. Setting Boundaries
      6. Rotating Toward the Center
      7. Shake Me
      8. Smoothing Out Values
        1. Using a high-pass filter
        2. Using a low-pass filter
    2. Conclusion
  13. 9. Camera
    1. The Gallery Application and the CameraRoll Class
      1. Selecting an Image
      2. Adding an Image
    2. The Camera Application and the CameraUI Class
      1. Uploading to a Remote Server
    3. EXIF Data
    4. Conclusion
  14. 10. Geolocation
    1. Geolocation Classes
      1. The GeolocationEvent Class
    2. Locating a Device Using Global Positioning System and Network/WiFi Technology
      1. Using GPS
        1. Signal-to-noise ratio
        2. Assisted GPS
      2. Using the Cellular Network and WiFi
      3. How to Know if GPS or WiFi Is Active
    3. AIR and Android
    4. Reverse Geocoding
    5. Maps
      1. Launching Google Maps
      2. Static Maps
        1. The Yahoo! Map Image API
        2. The Google Static Maps API
      3. Dynamic Maps
        1. The Google Maps API for Flash
        2. Styled Maps support
        3. Google Maps 5
    6. EXIF Data and the Map Object
    7. The speed Property
    8. Conclusion
  15. 11. Microphone and Audio
    1. The Microphone
      1. Recording Audio
      2. Playing Back Audio
      3. Saving a Recording
        1. The BLOB type
        2. WAV files
        3. Open source libraries
        4. Saving to a remote server
    2. Audio Assets
      1. Embedding Files
        1. Using Flash Professional
        2. Using Flash Builder
      2. Using External Files
      3. Settings and the Audio Codec
        1. Compression
        2. Bit rate
        3. Sampling rate
        4. Stereo or mono
    3. Working with Sounds
      1. Loading Sounds
        1. Streaming
      2. Playing Sounds
      3. Displaying Progress
      4. Stopping Sounds
      5. Resuming Sounds
      6. Accessing Metadata
      7. Audio Example Using Multitouch
    4. ID3 Tags
    5. Modifying Sound
      1. Controlling Volume
      2. Panning
    6. Raw Data and the Sound Spectrum
    7. Audio and Application Activity
    8. Conclusion
  16. 12. Video
    1. Preparing Video
      1. Codecs
        1. Encoding
        2. Decoding
      2. Bit Rate
      3. Frame Rate
      4. Resolution
      5. Performance
    2. Playing Video
      1. Embedded Video
      2. External Video
      3. Progressive Video
        1. SD card
        2. Browsing for video
        3. Metadata
        4. Cue points
        5. Buffering
      4. RTMP Streaming
        1. RTMP server
        2. Local Flash Media Server
      5. HTTP Dynamic Streaming
      6. Peer-to-Peer Communication
      7. Controls
      8. YouTube
    3. Capturing Video
      1. Video and the CameraUI Class
      2. The Camera Class
      3. Documentation and Tutorials
    4. Conclusion
  17. 13. StageWebView
    1. The Native Browser
    2. The StageWebView Class
      1. Design Considerations
      2. Local Use
      3. Mobile Ads
      4. Services and Authentication
      5. Limitations
    3. Conclusion
  18. 14. Hardware Acceleration
    1. Some Definitions
    2. Rendering, or How Things Are Drawn to the Screen
      1. Computation
      2. Edge and Color Creation
      3. Rasterization
      4. Presentation
    3. GPU Rendering on Android
      1. The cacheAsBitmap Property
      2. The cacheAsBitmapMatrix Property
    4. The Display List
      1. Memory Consumption
      2. Tree Structure
      3. Node Relationship
      4. MovieClip with Multiple Frames
      5. Interactivity
      6. Multiple Rendering Techniques
      7. Maximum Texture Memory and Texture Size
      8. 2.5D Objects
      9. How to Test the Efficiency of GPU Rendering
    5. Matrices
      1. Identity Matrix
      2. Transformation Matrix
      3. Matrices for Multiscreen Deployment
      4. Matrices Not to Be Used in GPU Mode
    6. Hardware-Accelerated Audio and Video
    7. Conclusion
  19. 15. Your Device and Others
    1. RTMFP UDP
    2. P2P Over a Local Network
      1. Color Exchange
      2. Companion AIR Application
    3. P2P Over a Remote Network
      1. Simple Text Chat
      2. Multicast Streaming
        1. Publisher
        2. Recipients
        3. Sending and receiving data
        4. Closing a stream
      3. End-to-End Stream
        1. Sending a peer-assisted stream
        2. Receiving a stream
      4. Directed Routing
        1. Sending a message
        2. Receiving a message
      5. Relay
      6. Treasure Hunt
      7. Other Multiuser Services
    4. Arduino and Physical Computing
    5. Conclusion
  20. 16. ViewManager
    1. Navigation
      1. ViewManager
        1. Creating views
        2. The initial view display
        3. The current view display
        4. The IView interface
        5. Creating a custom event
      2. Individual Views
        1. Inheritance
    2. Breadcrumb Navigation
    3. Flash Builder ViewNavigator
    4. Conclusion
  21. 17. Case Study
    1. The Album Application
      1. Design
      2. Architecture
      3. Flow
      4. Permissions
      5. Navigation
      6. Images
      7. Audio
      8. Reverse Geolocation
      9. SQLite
      10. P2P Connection
      11. Scrolling Navigation
      12. Desktop Functionality
    2. Conclusion
  22. 18. Asset Management
    1. Text
      1. The Virtual Keyboard
      2. Fonts
      3. The Flash Text Engine
    2. Optimizing Art
    3. Bitmap Size and Mip Mapping
    4. Vector Graphics at Runtime
      1. Scaling
      2. cacheAsBitmap
      3. cacheAsBitmapMatrix
      4. Vector to Bitmap
      5. Compositing Vector Graphics
      6. MovieClip with Multiple Frames
    5. Sprite Sheet and Blitting
      1. Blitting
    6. Custom Cursor
    7. Asynchronous Bitmap Decoding
    8. Caching Assets
    9. Components
    10. Conclusion
  23. 19. Best Practices for Development
    1. Resources on Optimization
    2. Where to Find Help
      1. Documentation
      2. The Internet
      3. The Community
    3. How Does It Run?
      1. The Concept of Frame
        1. Calculating the frame rate
        2. Improving performance
    4. Memory
      1. Creating Objects
      2. Removing Objects
      3. Garbage Collection
    5. Events
      1. Event Propagation
      2. One Listener for Many Children
      3. Generic and Custom Events
    6. Diagnostics Tools
      1. Hi-Res-Stats
      2. Flash Builder Profiler
      3. Flash Preload Profiler
      4. Grant Skinner’s PerformanceTest
      5. Native Tools
    7. Conclusion
  24. Index
  25. About the Author
  26. Colophon
  27. Copyright

Product information

  • Title: Developing Android Applications with Adobe AIR
  • Author(s): Véronique Brossier
  • Release date: May 2011
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781449394820