When we talk about mobile development, we have to make sure our application is optimized as good as possible to run smooth on a wide variety of devices. Like Kevin Lynch said at MAX 2010, mobile development is like desktop/web development 7 years ago. Let’s take a look on how we can make sure that our mobile applications run smooth. I can already tell you that always a lot of testing (starting early in your development process) on different devices will be necessary to achieve the results you want.
When your application slows down on a device, it means that your code execution per frame or the rendering per frame or both is the bottleneck.
Always make sure you use the right DisplayOject for the right job. As you know, a MovieClip uses more bytes then a Sprite and Sprite uses more bytes than a Bitmap…etc. When building up your DisplayList always keep in mind that the DisplayList really affects the memory usage of your application. If you have a set of Sprites on your stage for example, you can draw them in a BitmapData object and put that in a bitmap on the DisplayList. That approach will save some memory for sure!
When we talk about Bitmaps, we have to say something about the 2 Flash player render operations also. In the Flash Player every graphical element in your application is rasterized inside a bit/pixel buffer (=rasterizing) and those tiles of pixels are then arranged to make up your scene (=scene compositing) in the main pixel buffer (what you finally see on the device). Every frame, the player calculates a dirty region (=the redraw regions) to see what must be rasterized again and merged again in the main pixel buffer. All those tasks are done by the CPU when doing web/desktop development but with Adobe AIR 2.5 targeting mobile devices, you can choose if the CPU or the GPU needs to do those important tasks.
At this moment on IOS, a ‘special’ GPU mode is only supported, it is called GPU Blend. This means that the task of the the creation of the different pixel buffers is done by the CPU and then the CPU sends it to the GPU. The GPU finally does the scene compositing.
On Android, when you use GPU rendering, this is called GPU Vector, the tasks are done fully by the GPU. So, the creation of individual pixel buffers and the scene compositing, it all happens at the GPU. This can give you a huge performance boost. But can we make sure we are using GPU rendering?
That is where bitmap caching comes in.
Quick post to spread the news that the Adobe® Ideas v1.1 update went live this morning on the iTunes US store.
Adobe® Ideas is an iPad and iPhone app that allows creative professionals to leverage devices for their ideation process. Capture and explore your ideas with Adobe Ideas, then import them into Adobe® Illustrator®, Adobe® Photoshop® and other creative tools as starting points. Now with a new in-app purchase option, you can get up to 10 drawing layers plus a photo layer for each sketch and control opacity for each layer.
Anyone! Adobe Ideas is a fun way to capture ideas whether you are taking notes, doodling, or sketching. Also if you happen to use Adobe Illustrator or Photoshop, you can take your work from Adobe Ideas to Illustrator or Photoshop and keep working.
Download page: http://itunes.apple.com/us/app/adobe-ideas-1-0-for-ipad/id364617858?mt=8
Web page on Adobe.com: www.adobe.com/products/adobeideas <http://www.adobe.com/products/adobeideas>
Facebook page: http://www.facebook.com/adobeideas
Flickr Gallery: http://www.flickr.com/groups/1408891@N21/
In this example we will develop a simple mobile AIR application that let the user capture some video with the built in Camera application, and bring the video back into the AIR application. Accessing one camera is a cool new feature in Adobe AIR 2.5.
What I really like about Adobe AIR 2.5 mobile development is that the tools (Adobe Flash CS5 or Flash Builder Burrito) give you the possibility to immediately test on a real USB connected device. At adobe MAX 2010 a few weeks ago we all got a brand new Motorola Droid 2 device so that will be my testing device. When I first played with the telephone I had some problems in running the pre- installed AIR applications. It seemed that in some way the Adobe AIR plugin was not correctly installed. But no problem, I went to the Android market, downloaded and installed Adobe AIR again. Then I was able to run the installed AIR applications (Gravity Lander, GridShock,…) which is cool.
So first step is to make sure your mobile device runs Adobe AIR 2.5. You can install AIR 2.5 on Android devices running Android 2.2 (Froyo).
Next step is to make sure that your device is connected to your computer. For more information on connecting your Android devices to your computer look into this guide: Connect your Android device to your computer
You also have to make sure that your mobile device is configured well. You have to set USB-debugging on, turn off mass storage mode and enable charge mode. For more information also go to the above URL.
Next step is to check that your mobile device is on the same wireless network so it is able to connect to the debugger. If you are on Windows (7, Vista, XP) make sure to disable your firewall because port 7935 must be open to make a connection between your device and your computer. Also install the necessary USB driver for your mobile device. There are some USB device drivers preinstalled when you install Flash Builder Burrito (Google Nexus One, Motorolla Droid, HTC Incredible,…)
Let’s go ahead by setting up a new ActionScript Mobile Project in Flash Builder Burrito and in the document class we have to check if our device actually supports the Camera. It is a best practice that when you use specific features of a mobile device you always do a check first to see if that feature is supported.