Application Lifecycle
The user experience is the most important
feature in Windows Phone. After learning many lessons from the
competition and from its own experience with Windows Mobile devices,
Microsoft decided it would control process execution on the phone. The
main reason for this is that on a device like this, the number of
applications running can severely impact the quality of the user
experience. On the Windows Mobile platform and Android devices full
multitasking is allowed, but most users quickly learn to use a
task-killer application to kill applications that no longer are required
to be opened. This is an adequate solution for multitasking but does
require that the memory on the device be managed by users. While power
users will be comfortable with this, most users will not.
To enable developers to build rich
applications that act and feel as though multitasking is enabled,
Windows Phone uses an approach that allows applications to be paused,
made dormant, and suspended without having to alert the user that the
application is being paused. It does this by notifying the application
when it is being paused; then the application is also notified when it
is to resume running. In the pause and resume states, the application is
given a chance to save and load data to give the user the impression
that the application never stopped. In Figure 1 you can see how an application will go through the five states during its lifetime. This lifecycle is called tombstoning.
Figure 1. Application lifecycle (tombstoning)
If you ignore the
pause and resume states, your application will simply act as though it
was restarted by the operating system. This lifecycle is used for the
majority of applications. Microsoft allows only a small number of
partners to run outside this lifecycle.
Driving Your Development with Services
While some applications will only access
data on the phone, in practice many applications will need to use the
data connectivity to interact with servers and the cloud.
The phone is a connected device (meaning Internet connectivity is
available most of the time). This means you can power your applications
via traditional services such as Web APIs or Web services. These are
typically services that are either Web-enabled (like Amazon’s Web APIs)
or custom services you write in the cloud.
To power the phone, Microsoft has also exposed a number of services to simplify phone development, as described in Table 1.
Table 1. Microsoft Phone Services
Live Tiles
The center of the entire user interface
paradigm in Windows Phone is the notion of the Start screen. The hub is
the main screen that users will be presented when they boot up or turn
on the phone. Unlike the interface that the two main competitors (iPhone
and Android devices) present, the hub is not just a collection of
application icons, but rather a set of Live Tiles. These tiles include
information about the state of the information inside the application.
For example, the People tile in the Start screen will include pictures
of the last few updates the people on your device have had. This is an
indication that you may want to go to the People application on your
phone to see the updates. Figure 2 shows this transition from tile to application.
Figure 2. A tile in the hub
This lets you, the application developer,
control what the tile looks like. So you could decide on just a simple
numbering system like the Phone or Outlook tiles, or you could change
the look and feel completely, like the People tile.
The way that tiles get updated is powerful
as well. Ordinarily you might consider that applications themselves
would update the tiles, but that would assume your application would
need to be launched whenever the tile needs updating. Instead, the phone
uses the Notification Service to allow you to send an update to the
phone through Microsoft’s own service to update the tile. This works
well because the update is very performant (as the update simply
includes the information about the updated tile and never needs to start
your application to update the tile). In addition, this means that
ordinarily cloud services (like server-side applications) can update the
tile as well in a very efficient way. Figure 3 illustrates a simple update to a tile.
Figure 3. Updating tiles
While it is easy to
treat the hub like the Desktop in Windows, it should be treated
differently. It’s the dashboard to the user’s data, not just shortcuts
to applications. Users should be able to view the hub and see the basic
information they need in order to decide how to interact with the data.
For example, if there are new email messages, voice-mail messages, and
Facebook updates, users should be able to see at a glance what is
happening to themselves online and allow their phone to be a window to
that world.