Android

 

Embed or link this publication

Popular Pages


p. 1

developing android applications with adobe air véronique brossier beijing · cambridge · farnham · köln · sebastopol · tokyo

[close]

p. 2

developing android applications with adobe air by véronique brossier copyright © 2011 véronique brossier all rights reserved printed in the united states of america published by o reilly media inc 1005 gravenstein highway north sebastopol ca 95472 o reilly books may be purchased for educational business or sales promotional use online editions are also available for most titles http my.safaribooksonline.com for more information contact our corporate/institutional sales department 800 998-9938 or corporate@oreilly.com editor mary treseler production editor kristen borg copyeditor audrey doyle proofreader kristen borg printing history may 2011 first edition indexer john bickelhaupt cover designer karen montgomery interior designer david futato illustrator robert romano nutshell handbook the nutshell handbook logo and the o reilly logo are registered trademarks of o reilly media inc developing android applications with adobe air the image of a royal flycatcher and related trade dress are trademarks of o reilly media inc many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks where those designations appear in this book and o reilly media inc was aware of a trademark claim the designations have been printed in caps or initial caps while every precaution has been taken in the preparation of this book the publisher and authors assume no responsibility for errors or omissions or for damages resulting from the use of the information contained herein isbn 978-1-449-39482-0 [lsi 1303389007

[close]

p. 3

1 air 1 installing the adobe development tools flash professional cs5.5 flash builder 4.5 installing the air runtime on an android device what is in the air sdk new actionscript libraries functionalities not yet supported air on the desktop versus air on android mobile flash player 10.1 versus air 2.6 on android 2 2 2 2 3 4 5 5 6 2 call me text me 7 setting up your device creating a project using flash professional using flash builder creating the application descriptor using flash professional using flash builder writing the code using flash professional using flash builder packaging your application as an apk file and installing it on the device using flash professional using flash builder testing and debugging 8 8 8 9 9 9 9 10 11 12 12 12 13 13

[close]

p. 4

using flash professional using flash builder mobile utility applications launchpad device central cs5 package assistant pro de monsterdebugger installing air on an android device via a server other tools conclusion 13 14 15 15 15 15 16 16 16 18 3 android 19 android software development kit installing the android sdk installing the android debug bridge detecting your device using the dalvik debug monitor using the logcat command using the virtual device manager and emulator how does air run on android starting air with intent air access to android apis using the command-line tool a basic review conclusion 20 20 21 22 22 23 24 25 25 26 27 27 28 4 permissions certificates and installation 29 why mobile the apk file creating the application icon choosing the application settings setting permissions packaging external resources signing your application with a certificate versioning registering as an android developer publishing an application on the android market uploading assets listing details publishing options distributing applications via adobe inmarket publishing for the amazon market controlling distribution by using the mac address 29 30 30 31 33 36 36 37 38 38 38 38 39 39 40 40

[close]

p. 5

launching an air application monetizing your application paid applications mobile ads reporting conclusion 41 41 41 41 42 43 5 evaluating device capabilities and handling multiple devices 45 hardware the processor memory and storage the camera sensors the battery the display software performance capabilities orientation creating content for multiple screens asset scaling and positioning vector graphics or bitmaps developing a deployment strategy considering connectivity conclusion 45 46 46 46 46 46 47 47 48 48 49 50 51 54 54 55 55 6 opening and closing an application and saving data 57 the air application opening the application closing the application moving between the background and foreground setting back menu and search buttons overriding a dimmed screen why and how to save data internal or external storage local sharedobject the filesystem using the sqlite database embedding a database using encrypted local storage conclusion 58 58 58 59 61 61 62 63 65 66 70 76 77 77

[close]

p. 6

7 multitouch technology 79 a brief history what is multitouch and gesture how does it work the multitouch class the gestureevent class the zoom gesture the rotate gesture the pan gesture the swipe gesture the press and tap gesture the two-finger tap gesture the touchevent class the gestureworks library designing for touch conclusion 79 80 80 81 82 82 83 85 86 87 88 88 91 91 92 8 accelerometer 93 what is a motion sensor the accelerometer class visualizing the values a simple animation updates and screen rendering setting boundaries rotating toward the center shake me smoothing out values conclusion 93 93 95 95 96 97 98 99 100 102 9 camera 103 the gallery application and the cameraroll class selecting an image adding an image the camera application and the cameraui class uploading to a remote server exif data conclusion 103 104 109 109 111 111 114 10 geolocation 115 geolocation classes the geolocationevent class locating a device using global positioning system and network/wifi technology 115 117 118

[close]

p. 7

using gps using the cellular network and wifi how to know if gps or wifi is active air and android reverse geocoding maps launching google maps static maps dynamic maps exif data and the map object the speed property conclusion 119 119 120 121 122 124 124 125 129 132 134 134 11 microphone and audio 137 the microphone recording audio playing back audio saving a recording audio assets embedding files using external files settings and the audio codec working with sounds loading sounds playing sounds displaying progress stopping sounds resuming sounds accessing metadata audio example using multitouch id3 tags modifying sound controlling volume panning raw data and the sound spectrum audio and application activity conclusion 137 138 139 140 144 144 144 145 147 147 149 149 150 151 151 152 152 152 152 154 154 158 158 12 video 161 preparing video codecs bit rate frame rate 161 161 163 163

[close]

p. 8

resolution performance playing video embedded video external video progressive video rtmp streaming http dynamic streaming peer-to-peer communication controls youtube capturing video video and the cameraui class the camera class documentation and tutorials conclusion 163 164 164 165 165 165 169 171 171 171 172 172 172 175 176 176 13 stagewebview 177 the native browser the stagewebview class design considerations local use mobile ads services and authentication limitations conclusion 177 178 180 181 182 184 185 185 14 hardware acceleration 187 some definitions rendering or how things are drawn to the screen computation edge and color creation rasterization presentation gpu rendering on android the cacheasbitmap property the cacheasbitmapmatrix property the display list memory consumption tree structure node relationship movieclip with multiple frames interactivity 187 188 189 189 189 190 190 190 193 195 195 196 196 198 198

[close]

p. 9

multiple rendering techniques maximum texture memory and texture size 2.5d objects how to test the efficiency of gpu rendering matrices identity matrix transformation matrix matrices for multiscreen deployment matrices not to be used in gpu mode hardware-accelerated audio and video conclusion 199 199 199 200 200 200 201 202 202 203 203 15 your device and others 205 rtmfp udp p2p over a local network color exchange companion air application p2p over a remote network simple text chat multicast streaming end-to-end stream directed routing relay treasure hunt other multiuser services arduino and physical computing conclusion 205 206 208 210 210 212 213 215 217 218 219 219 220 220 16 viewmanager 221 navigation viewmanager individual views breadcrumb navigation flash builder viewnavigator conclusion 221 221 225 232 234 237 17 case study 239 the album application design architecture flow permissions navigation 239 240 240 240 243 244

[close]

p. 10

images audio reverse geolocation sqlite p2p connection scrolling navigation desktop functionality conclusion 244 244 244 244 245 245 248 249 18 asset management 251 text the virtual keyboard fonts the flash text engine optimizing art bitmap size and mip mapping vector graphics at runtime scaling cacheasbitmap cacheasbitmapmatrix vector to bitmap compositing vector graphics movieclip with multiple frames sprite sheet and blitting blitting custom cursor asynchronous bitmap decoding caching assets components conclusion 251 251 252 252 254 254 255 255 255 255 256 256 257 259 259 261 261 261 262 263 19 best practices for development 265 resources on optimization where to find help documentation the internet the community how does it run the concept of frame memory creating objects removing objects garbage collection 265 266 266 266 267 267 267 269 270 270 272

[close]

p. 11

events event propagation one listener for many children generic and custom events diagnostics tools hi-res-stats flash builder profiler flash preload profiler grant skinner s performancetest native tools conclusion 273 274 275 276 277 277 278 279 279 279 279 index 281

[close]

p. 12

chapter 1 air intelligence is the faculty of making artificial objects especially tools to make tools henri bergson adobe integrated runtime air initially code-named apollo was created in 2007 as an environment for building rich internet applications rias running outside the browser while benefiting from desktop features with air developers can write desktop software using actionscript html or javascript for the windows macintosh and linux platforms each application is installed as a standalone client application its proper execution requires that the air runtime be installed in the environment figure 1-1 shows the apollo and air logos figure 1-1 apollo and air logos air version 2.5 focused on mobile development and introduced new features such as geolocation capability accelerometer capability and multitouch inputs air is targeted at smartphones as well as tablet computers and netbooks air 2.5 and later supports the android platform android is an operating system based on the open source linux platform it was initially developed by google and was further expanded by the open handset alliance for use with mobile devices android runs applications developed using the java programming language and packaged as an android package apk file 1

[close]

p. 13

adobe adapted air as a tool for actionscript programmers to make android applications html/ajax mobile development is not available for air for android the purpose of this book is to teach you everything you need to know and more to develop air applications for the android platform beyond android the adobe open screen project has brought air to rim for blackberry and is committed to bringing it to other partners in the future for more information on the open screen project go to http www.openscreenproject.org the premise of this effort is to offer a uniform tool for a fragmented mobile world one could hope that air will be to mobile development what flash player is to the internet it enables ease of development and distribution of applications across platforms and browsers installing the adobe development tools the adobe development tools come in several forms flash professional cs5.5 and flash builder 4.5 they support android os 2.2 named froyo and later as well as devices with an armv7 or higher processor air for android does not work with earlier versions of the android system flash professional cs5.5 the latest version of flash professional comes with the air for android extension bundled no separate download or additional installation is needed when you launch cs5.5 and select filenew you will see an air for android option under the general tab or an air for android category under templates flash builder 4.5 burrito is the code name for the new version of flash builder in public beta at the time of this writing you can download burrito from the adobe labs website at http labs .adobe.com/technologies/flashbuilder_burrito burrito has templates for flex mobile and actionscript mobile projects both products flash professional and flash builder include the air sdk and tools to automate deployment to devices we will build our first air for android application in chapter 2 installing the air runtime on an android device the air runtime stores the native as classes which an android application can reference it is invoked by your application when it launches it only needs to be installed on the device once and is shared by all air applications 2 chapter 1:air

[close]

p. 14

the air runtime is the c/c implementation of the flash engine rendering engine and virtual machine the air runtime comes installed on some new android devices but not all as with all applications installed on an android device the air runtime is packaged as an apk file if you do not have adobe air yet search for it in the android market application on your device download it and install it you will need it in the next chapter future air updates will also be deployed via the android market to adapt to android evolution for instance the air 2.6 runtime became available in february 2011 to run on android 2.2 froyo android 2.3 gingerbread and android 3.0 honeycomb it provides new features and performance improvements using air on android creates an additional layer on top of the platform and communicates with it you do not need to know the inner workings of this process but being familiar with the android system may be helpful chapter 3 will go over some of that what is in the air sdk the air sdk is the set of tools used to package and deploy your air application it comes bundled in the tools so no additional installation is needed the tools take care of accessing these files without any development on your part the air sdk consists of the following air developer tool adt adt is a multipurpose tool written in java it requires java 1.5 or later and is used to package the air application for android devices it creates a different package based on the target defined apk for distribution apk-emulator for the emulator or apk-debug to debug locally or on the device adt creates the self-signed digital code certificate used to sign the application with an option to expand the validity period to conform to android specifications it installs uninstalls and launches the application on the android device the adt tool is called adt or adt.bat and is located in the bin folder adt.jar is the executable file called by adt or adt.bat and is located in the lib folder air debug launcher adl adl is used to test your air application during development without packaging it it uses the runtime included in the sdk and prints trace statements and runtime errors it is also used to start a flash debugger fdb session the adl tool is called adl or adl.exe and is located in the bin folder what is in the air sdk 3

[close]

p. 15

air runtime the air runtime is used to launch and test your application during the development and debugging process before you install the application on the device it contains the emulator and device versions for both desktop and android devices the air runtime is called runtime.apk and is located in the runtimes folder frameworks the frameworks directory includes all the air core libraries adobe recently made available some documentation on using the command-line tool for adt we will cover these commands in chapter 3 if you need an explanation or a refresher on using the command-line tool please refer to using the command-line tool on page 27 in chapter 3 new actionscript libraries many libraries were added to air 2.5 with a specific focus on mobile development we will cover all of them in detail in the chapters to come here is a list of the new functionality and apis and the chapters in which they are discussed chapter 2 call me text me · air application debugging on android · simulation on the desktop · uri schemes to invoke native android applications chapter 4 permissions certificates and installation · application icons · certificate validity · application permissions · application versioning chapter 5 evaluating device capabilities and handling multiple devices · screen orientation api · system idle detection and overwrite · new soft keys to register for keyboard events on the android device · virtual keyboard chapter 7 multitouch technology · gestures · multitouch capability chapter 8 accelerometer · accelerometer 4 chapter 1:air

[close]

Comments

no comments yet

YOUBLISHER
About
What Others Say
Sitemap
Impressum

PUBLISHERS
Login
Signup
Tutorials
FAQ
Support

BUSINESS
Overview
Advertising
Support

DEVELOPERS
API

LEGAL
Report a Copyright Violation
Copyright FAQ
Terms of Use
Privacy Policy