Week 18: Mobile development technologies
Introduction
Last week we covered cross-platform mobile web development with WURFL. This is all very well if all we want to do is create websites which are viewable on a mobile device, but often we want to write custom applications for mobile phones, i.e. standalone applications which run independently of a web browser. Why might we want to do this?
- We might want to save data in files. A web application does not allow us to do this, apart from through the use of cookies (which can only store a limited amount of data)
- We might want to talk to the mobile phone's hardware, such as its camera or its GPS (see below). Again a web application will not allow us to do this.
- We might want greater control over the visual appearance of the application than is possible with a web application. Standalone applications allow us to be more flexible in drawing graphics, animation, etc. We might even want to develop a 3D application, such as a 3D game.
How to develop a mobile application
Typically you download a Software Development Kit to a desktop machine, which comes with an emulator - a graphical representation of a phone which you can test your application on. You develop and debug your code on a desktop machine, and then transfer it to a mobile device, once it's known to work on the emulator. Of course further bugs might come to light on the actual mobile device - probably the trickiest part of mobile development!
Location based applications - GPS
Before considering the different development options and mobile operating systems, a word on GPS (Global Positioning System) as this is one of the most exciting developments in the mobile software world. Certain mobile phones (e.g the Nokia N95/96/97) can use GPS - a series of satellites controlled by the US - to locate you on the Earth. This is the same technology that car "satnav" (satellite navigation) systems use.
This allows the development of interesting mobile applications that use your position on the Earth to deliver information about nearby points of interest, such as pubs or restaurants, through your phone. GPS enabled phones are the most effective for these location based applications, but any phone can use the mobile phone mast system to give an approximate location on the Earth.
Mobile operating systems
Back to the main topic of this week, and what options are available for the development of native (standalone) mobile applications? The first thing to consider is the operating system as different programming languages are supported by different operating systems. The main operating systems are:
- Symbian: the operating system used by many phones, notably those of Nokia, including the N95/96/97.
- iPhone OS: Apple's operating system, used on the iPhone.
- Windows Mobile: A cut-down version of Windows for phones.
- Android: An open source operating system based on Linux, developed originally by Google and later by the multi company Open Handset Alliance (see Wikipedia article).
Mobile development technologies
So what are the development options for actually creating applications for mobile devices? These are the main options:
- Java ME
- Symbian C++
- .NET Framework (Windows Mobile)
- iPhone, Objective-C
- Android
- Qt
Java ME (Java Micro Edition)
The most widespread development option for mobile devices is probably Java ME (Java Micro Edition). This is a slimmed down version of the full Java programming language (one of the most commonly used programming languages today) for hardware with relatively limited memory and processing power, such as many mobile phones. We will be looking into Java ME in more detail next week but here are its key features.
- Java is a relatively easy programming language compared to some of the other options, like C++.
- It's easy to get going on Java ME development for phones on Windows and Linux, though a bit more awkward on Mac OS X. All you need to do is download a version of Java (obtainable from java.sun.com) and the Wireless Toolkit (WTK), a development environment for Java ME which comes with a phone simulator (i.e you can see a graphical representation of a phone on your computer, and see what the application will actually look like on a phone).
- Java ME is supported by the majority of mobile operating systems though not the iPhone. Also it does not come by default with Windows Mobile Edition, though you can install Java and run Java applications on it.
So what are the disadvantages?
- Java ME is rather cut down compared to the full Java (for example you have to write your own natural logarithm or power functions) but with a bit of effort you can create powerful and interesting applications.
- Java is compiled into "bytecode" - an intermediate language in between Java code and machine code - so it is theoretically not as fast as other options which compile straight to native machine code. However unless the application is complex in practice this is not a major issue.
- Other Java based options, e.g. some of the versions of Java you can get for Windows mobile, or Android, are more full featured.
Symbian C++
Having talked about Java ME, it makes sense to move on to Symbian C++ because for many of the most common devices, this is the alternative. As discussed already, many mobile devices use the Symbian operating system. C++ is a programming language similar to Java, but allows more direct control over the hardware. This makes it very powerful, but also makes it easier to make mistakes and possibly crash the device. Advantages of Symbian C++:
- Fast, as it is compiled to the native machine code for that particular mobile device;
- Direct control over hardware: you can do things which would not be possible with Java ME.
- Easier to crash the device if there are bugs in your code;
- Symbian C++ is fairly awkward to program.
- Will only run on Symbian phones, though many of the most common phones do run the Symbian OS.
.NET Framework for Windows Mobile
Windows Mobile phones do not come with Java ME installed, although you can install Java to them yourself which allows you to write Java applications. However the normal way of writing applications for Windows Mobile is the same as the normal way of writing regular Windows applications: the .NET framework. The .NET framework is a library developed by Microsoft to allow you to create graphical and network applications on Windows operating systems, and since Windows Mobile is a Windows operating system, you can write .NET applications for it. In terms of the actual programming languages, you would use either Visual Basic or C#.
Advantages of .NET framework:
- Windows developers, with experience in developing desktop applications for the Windows platform, will find it easy to develop new applications, or port existing applications to, Windows Mobile devices.
Disadvantages:
- Not cross platform: applications will not run on other mobile operating systems.
iPhone
Apple's iPhone is, like the Nokia N95/96/97, one of the more advanced "smartphones" available. It runs its own operating system and consequently you need to write applications built specifically for the iPhone. iPhone applications are developed in a language called Objective-C, which is related to C++; like C++, Objective-C adds object orientated capabilities to the older C language. Since it is an Apple product, developing for the iPhone shares similarities to developing desktop applications for the Mac.
Advantages of iPhone development:
- Fast, as it is compiled to the native machine code for the iPhone;
- Nicer user interfaces than many of the alternatives;
- Applications will run on certain iPods (iPod touch) as well as the iPhone;
- Quite easy to get publicity for your application, as you offer it or sell it through Apple's App Store.
Disadvantages:
- Not cross platform;
- Objective-C is a fairly unusual programming language;
- The main disadvantage though is how you can distribute your application. At the moment, you have to distribute it through Apple's AppStore, and there is the risk that Apple may not accept your application for hosting on the AppStore. As "smartphones" become more widespread, with more manufacturers offering them, this policy may change.
Android
One of the more recent entrants to the field of mobile development is Android. Android is a complete operating system available for mobile devices, based on Linux. Unlike every other option discussed here, it has been built from the ground up to be open source; both the core operating system and the standard applications available are open source applications. To develop applications for Android, you use Java, but the libraries (add-ons to the language for developing graphics, network applications, etc) available are different from those available in Java ME. Android uses its own Java libraries for these tasks rather than those from Sun, the originator of Java.
Advantages of Android:
- Completely open source, so the workings of the operating system are available for anyone to inspect and even change. If the source code is completely open and someone wants to make the phone do something unusual, they can study the workings of the operating system through looking at the source code, and use what they have learnt to develop their code.
- From the phone manufacturer point of view: It is an open specification, so any manufacturer may use it without difficulty; no need for manufacturers to pay for the operating system.
- Uses Java, so easy to develop for if you know Java already, including Java ME;
- Backed by the Open Handset Alliance, a group of leading manufacturers and software companies, including Google, who as the leading net company can put a lot of resources into pushing Android.
Disadvantages:
- The main disadvantage is lack of support from hardware manufacturers so far. At present, only one widely available phone uses Android as its operating system, namely the T-Mobile G1. Again, as use of "smartphones" and the number of models available increases, more manufacturers may take up Android.
References:
Qt
The final option we'll consider is Qt. Qt is a library for developing cross-platform graphical and network applications in C++. So far it is available for a range of desktop operating systems such as Windows, Linux, Mac OS X and Solaris (Sun UNIX), and also Windows Mobile, but Nokia have announced Qt for Series 60 (Symbian) phones: see here. This is potentially a very exciting development as it means that it will be possible to develop truly cross platform applications which run on both desktop and mobile devices with only small changes (due to the smaller screen resolution of the phone). It is likely that Qt will have many of the advantages of Java ME (easy to develop for, cross platform) but without some of the disadvantages (compiles to native code, access to hardware). So the advantages of Qt:
- Established cross platform C++ library for graphical and network applications, so if you know Qt already, you can get going on mobile development straight away;
- Compiles to native machine code for Symbian, so fast;
- Uses C++ so direct access to hardware will be possible;
- Nicer to develop for than Symbian C++.
- Cross platform: it is already available for Windows Mobile, and will shortly be available for Symbian
- Developed by Nokia, one of the leading phone manufacturers; this can only enhance its prospects in the future.
- Open source (see Android, above)
Disadvantages:
- Not available for Symbian just yet; apparently available in the "second quarter" of this year (see the website).
- At the moment, you have to have Windows on your desktop machine to develop for the preview release; though this may change once the full release is out.
So what platform should you develop for?
As you can probably see from the above, mobile development is a fast-changing area with new options appearing all the time: the iPhone and Android options have only been available for the last year or so and Qt for Symbian is due in the near future. The best all round option right now is probably Java ME, though if you're developing specifically for an iPhone or a Windows Mobile device, you might want to go with Objective-C or the .NET framework respectively. Nonetheless it is worth keeping a close eye on Android and Qt, as these have the potential to become big in the not too distant future, particularly as they are both open source and being supported by big names in the web and mobile world.