Mobile development technologies
Introduction
There are a number of different options when developing for a mobile device such as
a phone. There are two general approaches: web development, and native application ("app")
development. Each is discussed below.
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.
Most contemporary smartphones, including most Android phones and many Nokias,
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 Web Development
One option in mobile application development is simply to
create websites for mobile phones. Increasingly
this option is becoming more and more viable as more and more can be done from JavaScript
in a browser environment. Some of the things now possible with JavaScript include:
- graphics, using the canvas tag;
- obtaining the phone's location on the earth (e.g. from an inbuilt
GPS chip), using the Geolocation API;
- limited client-side data storage (the "localStorage" facility)
Obviously you need a web browser capable of all these tasks. Many of these tasks are
possible with more up-to-date
browsers, such as Firefox for mobile and mobile browsers based around the
WebKit engine, such as the Android browser or Safari for the iPhone.
Native App Development
The other option is to write custom
applications (apps)
for mobile phones, i.e. standalone, native applications which run
independently of a web browser. Such native applications are popularly known as
apps. Why might we want to do this? Basically, native apps give you rather
more power as a developer to do what you want to do. Some examples:
- We might want to save data in files. A web application only allows limited
file storage
- We might want to talk to the mobile phone's hardware, such as its
camera or its GPS. While the newer mobile web browsers can do this to some extent,
they will not give you the same amount of control over the hardware that
a native app will.
- Usability: because development options for native apps are designed specifically
for mobile devices, they offer user interface elements geared specifically for
mobile users (e.g. touchscreen functionality).
By contrast, web development is not aimed specifically at
mobile users and a web app may not support the specific forms of user
interaction used by mobile users.
- 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. Again, the advent of WebGL (in-browser 3D graphics,
supported with Firefox 4 upwards) means that the
web option is becoming increasingly viable here.
- We might want a completely off-line application so the user doesn't have
to pay for net access, which sadly is still rather expensive, in the UK
at least. In this scenario, the user might download data from the web to their phone
in advance using their desktop machine; the phone would then work with the pre-downloaded
data.
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!
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:
- Android (Linux): An open source operating system based
on Linux, developed originally by Google and later by the multi company
Open Handset Alliance (see
Wikipedia article).
- iPhone OS: Apple's operating system, used on the iPhone.
- Windows Phone 7 (or the earlier "Windows Mobile") Windows
for smartphones.
- BlackBerry
- Symbian: the operating system used by many non-smartphones.
Formerly used on many Nokia smartphones, before they switched to
Windows Mobile.
Mobile development technologies
So what are the development options for actually creating applications
for mobile devices? The main options include:
- Android SDK
- iPhone, Objective-C
- .NET Framework (Windows Mobile)
- Java ME
- Qt, a cross-platform C++ based development framework available for
some mobile operating systems.
Android
One of the leading smartphone operating systems is
Android. In the past three
years Android has grown from a minority player to
one of the leading alternatives to the iPhone amongst touchscreen smartphones.
Android is a complete operating system
available for mobile devices, based on Linux. Unlike many of the other options,
it has been built from the ground up to be open source;
the core operating system (except the tablet-only Android 3.0)
and many of the standard applications available are
open source applications. To develop applications for Android, you use
the Android Software Development Kit (SDK) and the Java programming language,
but Android has a different runtime environment and GUI system to standard
(Sun/Oracle) Java. Consequently, existing Java applications will not run on
Android directly, but usually only the GUI need be rewritten.
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. Consequently a range of manufacturers
including HTC, Motorola and Samsung use Android.
- Uses Java, so easy to develop for if you know Java already.
- Developed by Google, who as the leading net company can put a lot of
resources into pushing Android.
Disadvantages:
-
Different Android devices support different versions of the operating
system, so what works on one Android phone may not work on another.
iPhone
Apple's iPhone is amongst the more advanced
smartphones available. It
runs its own operating system (iOS) and consequently you need to write
applications built specifically for the iPhone. iPhone apps
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;
- Applications will run on certain iPods
(the 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, which is very restrictive.
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.
This could lead to a lot of wasted development effort!
References:
Java ME (Java Micro Edition)
The formerly most widespread development option for mobile devices is
probably
Java ME (Java Micro Edition), though in the last
three years it has been increasingly
superseded by the iPhone and Android environments. 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. BlackBerry uses JavaME plus their own
extensions.
- 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 older mobile devices
(pre-iPhone and Android), particularly Symbian devices such as most
Nokias.
So what are the disadvantages?
- Less contemporary phones support Java ME than previously: for example, it is
not natively supported on either iPhone or Android.
- Limited in capabilities compared to some of the newer options, for example,
saving to and reading from files is tricky as you have to get your app
digitally signed by a certification authority to avoid "nag screens" every time
the app tries to save to file, and that can be expensive.
.NET Framework for Windows Phone 7/Mobile
Windows Phone 7/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 on a phone
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
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:
- Windows Phone 7 development has the same issue as iOS development:
applications must be distributed via Microsoft's equivalent to the Apple
App Store. Earlier versions of Windows Mobile did not have this issue.
- Not cross platform: applications will not run on other mobile
operating systems.
So what platform should you develop for?
It really depends upon the features of your application. With native mobile applications
("apps") you have a lot of flexibility compared to the web development (HTML/JavaScript)
option, but you need to develop separately for
each platform (iPhone, Android, Java ME, etc). So if you are aiming for a cross-platform
application which is relatively simple, it's probably best to go for the web option as
long as this does not impact negatively on usability. If
you wish to take advantage of all the features the phone offers, it's better to go for
a native app, but you may need to either
pick one platform (and just accept that your app will not work for the others) or
develop multiple versions.
Mobile applications and web services
Most mobile apps interact with the web. Mobile apps typically provide
location-based information. For example, a mobile app might look up the
nearest pubs and restaurants to the user. This would work as follows:
- the app would obtain the location from the phone's GPS device;
- the app would make a connection with the web service using HTTP
(all mobile application development environments can connect to a remote
server over HTTP);
- the app would send the device's current location over the web to an
appropriate web service;
- the service would look up the
pubs and restaurants within a certain distance of the user's
location and return them to the phone as XML;
- an XML parser within the phone app (most mobile app development
environments have a SAX parser) would interpret the data sent back to the
browser and incorporate it within the phone's interface.