Changes that Froyo brings to Android devs

by Ivan.Memruk  on  6. October 2010 05:10

Android 2.2 gets more and more massive. Nexus One owners have been running official Froyo for a while already, EVOs are getting the update these very days and only lazy Droid owners (out of those who care) did not upgrade their devices to 2.2 manually yet.

Obviously, the rest of 2.x devices are getting Froyo quite soon as well. As developers, we are more affected by new platform versions than consumers. I wrote this article to enumerate several things that Android 2.2 will change or introduce. I did not intend to mention everything - what I wanted was to give you an idea of how many changes of different scales and levels Froyo was bringing.

Faster Dalvik speed

As you perhaps know, Froyo brings JIT to Dalvik. That results in 2x-5x faster performance of most of the apps (5x might be rare but in any case it's noticeable with the bare eye). This is a drastic improvement and it does mean a lot to us developers.

When compared to iPhone, Android has often been criticized for somewhat jerky UI performance, especially on some weaker devices. Well, in many cases jerky scrolling and animations have become much smoother on 2.2, and that's for free for us developers - we don't need to change any code to take advantage of the higher Dalvik speed.

However, the performance improvements will also affect your benchmarks. As we discussed in one of the previous articles, you need to measure the exact performance benefits of every optimization before going for it. Now, if you target your app for 2.2 and higher, you can avoid costly optimizations, such as rewriting code in C, thanks to the improved JVM performance. (For example, the sharpen bitmap filter in that article now takes ~650ms rather than ~1000ms on my Droid. Still far from the 40ms in native code, but a considerable difference nevertheless.)

New APIs

Platform developers have been keeping us satisfied with new goodies in every new Android version, and 2.2 is no exception. There are various new features, including the cool (speech recognition), the useful (data backup) and the exciting (OpenGL ES 2.0).

Take OpenGL ES 2.0. It is the first OpenGL ES version to support GLSL - the shading language. It makes the OpenGL sorcery even more complex, but allows you to implement various reflection, refraction and surrealistic effects. You can see an example here, although it's not an Android device that that video is running on.

Considering the Data Backup API, it's actually one of the first Android platform services that spans mobile clients and the cloud. In essence, you are now able to save app settings, profiles, state etc. to the centralized Android Backup Service. The service is free but of course has some limitations that you need to be aware of, so be sure the read the official Data Backup docs.

To see an example of a smaller scale but still very useful feature, have a look at ScaleGestureDetector. Finally you can implement pinch zooming without taking code from the Gallery 3D app.

(Some) old issues solved

Although we love the Android platform, we still know its rough edges. The overall API design seems to be fine with everyone, but some specific classes and APIs do have room to be improved. And again, the platform development team has continued working on old APIs as well as new ones, and there are some new methods here and there added to old APIs in 2.2.

I covered the SoundPool API in the article on different audio APIs on Android. SoundPool is one of the neat ways to play sounds, but it lacked some minor features like making sure audio was loaded or stopping all sounds at the same time. Now it has both - see setOnLoadCompleteListener(), autoPause() and others.

In addition, you might be interested, for example, in Camera class changes that allow zoom manipulation.

Not to miss any small changes, be sure to read the official 2.2 version notes.

Backward compatibility

On a multi-versioned platform, any change or improvement, even a backward-compatible one, has a hidden cost of widening a gap between the new version and the old ones. Since Froyo is improved in so many ways, it is also very different from the previous versions. It's different from 2.1 in terms of performance and new APIs, and its difference from 1.5 and 1.6 that are still on the market, is very serious. What does that mean to those responsible for application functionality, quality and visual design?

First of all, the wider the margin between versions, the more testing we have to do. What works fine on 2.2 Froyo has even more chances to fail on 1.5 Cupcake than a piece of code written for 2.1 Eclair. It can fail in many ways - performance, visual differences, usage of new API etc. Whether we want it or not, progress brings fragmentation and we have to pay for it.

Even if everything works fine in the formal sense, supporting the whole range of versions (say, starting with 1.5) in a single app is becoming a bigger problem with each new version. The capabilities of 2.2 are so different from 1.5 that in some cases you will think of making two separate branches of the same app, regardless of how awful that idea might sound in the beginning.

Anyway, Froyo brings us a lot of new possibilities and takes the overall platform quality and feature set to a new level. Users are definitely enjoying Android 2.2, and as developers, we have to know what new capabilities it brings and how we handle it.

Author:

Ivan Memruk
mindtherobot.com

 

Related articles

Android Froyo is here
Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 ...
Should Android market be more regulated?
Android is undeniably one of the hottest products available to customers living in this era of tec...
15 Android features iPhone users will envy
The Android platform dubbed as the “The one of the most liberal platforms in the world&rdquo...

blog comments powered by Disqus
� 2010 WiseAndroid lightdir.com