Sunday, October 19, 2008

Tackling the mobile platform diverseness

With the emergence of new mobile platforms like iPhone and Android the diverseness of mobile platforms is greatly increasing. This brings some trouble for developers who try to target as many platforms and as wide audience as possible. Let's take a look at the platforms currently at hand.

First of all there is Series 40 which is Nokia proprietary platform that accepts only applications developed with Java ME, formerly known as J2ME. Also Flash Lite has been supported since S40 3rd Edition Feature Pack 1 for stand-alone applications and content. There are tens of millions S40 devices out there which makes this platform one of the most widely used.

When we are talking about Symbian, we are actually talking about three different platforms: S60 and UIQ. "But that is only two?", you say. Yes, but there is a compatibility break between S60 2nd and 3rd edition which means I'm counting them as two separate platforms. All of this is to change, though, when the S60 and UIQ platforms will be merged into the open source Symbian Foundation code. The S60 platform sucks and even Nokia developers admit it. Coding for Symbian is simply harder than it really should be. However, S60 is not going to die, at least not very soon. This is because Nokia is making money with the platform right now and is porting Qt application framework to the platform too which is going to expand its lifetime.

The iPhone OS or OS X iPhone is the operating system used in iPhone and iPod Touch. Mac OS X applications cannot be run on an iPhone device. Applications need to be specifically written and compiled for the iPhone OS and ARM processor architecture. Authorized native third party applications are available for the phone through Apple's App Store. The software developement kit allows developers to make applications and test them in a simulator but loading an application onto the devices is only possible after paying a iPhone Developer Program fee. Java or Flash are not supported but Sun Microsystems and Adobe have their plans to release a third party Java virtual machine and Flash Lite player respectively.

Google's Android platform is written in Java running on top of a Linux kernel written in C. However, it is not Linux. There are also some apparently performance critical libraries written in C/C++ but the application framework is fully written in Java. Flash is not supported but there shouldn't be any technical obstacles for it. Some people have said that Android is actually what Java ME should have been or should have become. Obviously software written for Android can't be run on other Java enabled devices. On the other hand it should be possible to run software developed with Java ME in an Android device.

MicroSoft's offering to the mobile market is of course Windows Mobile. Managed applications can be developed with .NET Compact Framework using the C# language. Native applications can be developed with C++. Both Java ME and Flash Lite are also supported.

The problem with Linux is the number of distributions involved. There is Maemo that is used in Nokia Internet tablets, LiMo foundation founded by companies like Motorola, NTT DoCoMo, Panasonic and Samsung, Mobilinux by Montavista, Moblin sponsored by Intel, Ubuntu Mobile and OpenMoko. You could actually say there is probably as many mobile linux distributions as there are other mobile platforms together. There are no common SDKs nor tools for developers, no common distribution channels, and no common application directories for devices. Linux people are going to kill me when I say this but unless some company is strong enough to create an uniform platform, there might be not so bright future for mobile Linux, which is a great shame.

BlackBerry smartphones are built on a Java-based operating environment, which supports the development of custom Java ME applications. There is a BlackBerry plug-in for MicroSoft Visual Studio that lets developers working within a .NET programming environment use their development tool of choice.

With the platforms mentioned I have addressed the majority of mobile devices out there. As you can see its almost impossible to target all the platforms at once. In practice there aren't any natively running cross-platform applications. How should this be handled then?

The easiest way to target every device is web-based applications. That way you reach every device out there equipped with a internet browser. Web applications are limited though and not applicable to every problem or service.

The second easiest coverage comes probably with Java ME. It is supported pretty much on every phone except the iPhone. Using Java you get access to a lot more interfaces of the phone but are still more limited than using native code and native APIs. It also differs too much from usual Java so code reuse is not possible. Sometimes the Java slogan, "Write once, run everywhere", has been changed to "Write once, debug everywhere". This refers to the issue that even if you can run the same code platform independently, it still might behave differently on different environments.

Qt has some potential becoming a solution to some of the problems. It is already available in embedded Linux and Windows Mobile and will soon be in Symbian and Maemo. There are also Java bindings via Qt Jambi which, at least in theory, enables Qt in Android too. Qt/Mac won't enable Qt in iPhone but it adds another theoretical possibility. Qt Extended, formerly known as Qtopia, extends Qt application platform with additional functionality to embedded Linux. It might not be a silver bullet but it actually might make several developers' life a lot easier.

Another problem with cross-platform development is that the screen resolutions, color depths, input devices and multimedia capabilities, just to name a few, are very different. A device could or could not have a keyboard or a touch screen and even the touch screen can be single touch or multi touch. Whether you are developing a web based service or a full blown native application these issues have to be taken into consideration. Moreover, using generic toolkits always is a trade-off between portability and utilizing the platform specific device capabilities. In most of the cases true cross-platform development is not feasible or sensible or even possible. Nevertheless, that doesn't mean that cross-platform toolkits wouldn't have their place in the market.


Hude said...

Technical preview of Qt for S60:

Teppo said...

One quite interesting approach could be utilisation of widgets.

Basically it should be possible to develop a widget that works in Microsoft Vista, Apple OS X and S60. I don't have yet any experience of this but they are all using same technologies (html, css, javascript). Of course there are limitations what you can do with a widget, but you could get quite many potential users with this kind of approach.

A service that uses widgets for providing information and informing user about important changes and a browser for doing things could be a success.

Currently widget platforms don't have access to device's resources but S60 5th edition introduces so called Platform Services. These services gives the widget access to calendar, contacts, GPS, messaging, audio, and video.

It is interesting to see if other manufactures follow Nokia's approach and how the security will be handled.

Hude said...

Well, just to avoid confusion, a widget in Qt is just any UI element. Those are already working in different environments. :)

What you are talking about is web runtime (WRT) widgets. As far as I know WRT is quite a hot topic for Nokia at the moment. I would also add XHMTL and Ajax to the list of technologies involved.

Hude said...

Apparently Flash is coming to Android.

Teppo said...

Sounds interesting. I think that Flash in mobile devices is a little complicated topic.

Normal Flash, which is used in web pages, don't work or don't work well in mobile devices. One example is Youtube's Flash videos work somehow, but not as smoothly as they should. These based on my experiences using Nokia N96.

On the other hand Flash Lite or simple Flash could be used and create some fine looking (mobile) applications.

Maybe Flash is now in same stage that XHTML MP (Mobile Profile) was few years ago? Everybody had realised that WML sucks and XHTML MP could be used to create simple applications that work both in mobiles and normal browser.

A year or two and then Flash can be used in mobile devices and in computers.

Hude said...

I think Flash experiences the same problems as any other technologies when brought to a mobile platform from desktop; it is not really feasible to try to scale down without adjustments.

I'm wondering what's the future of Flash? How will Ajax, Silverlight or JavaFX compete?