Types of Android Applications

Most of the applications you create in Android will fall into one of the following categories:

Complex applications are difficult to pigeonhole into a single category and usually include elements of each of these types. When creating your application you need to consider how it's likely to be used and then design it accordingly. Let's look more closely at some of the design considerations for each application type.

Android Types From

Foreground Applications

When creating foreground applications you need to carefully consider the Activity life cycle (described in Chapter 3) so that the Activity switches seamlessly between the foreground and the background.

Applications have little control over their life cycles, and a background application with no running Services is a prime candidate for cleanup by Android's resource management. This means that you need to save the state of the application when it is no longer in the foreground, to let you present the exact same state when it is brought to the front.

It's also particularly important for foreground applications to present a slick and intuitive user experience. You'll learn more about creating well-behaved and attractive foreground Activities.

Background Services and Intent Receivers

These applications run silently in the background with very little user input. They often listen for messages or actions caused by the hardware, system, or other applications, rather than rely on user interaction. It's possible to create completely invisible services, but in practice it's better form to provide at least some sort of user control. At a minimum you should let users confirm that the service is running and let them configure, pause, or terminate it as needed.

Intermittent Applications

Often you'll want to create an application that reacts to user input but is still useful when it's not active in the foreground. Chat and e-mail apps are typical examples. These applications are generally a union of visible Activities and invisible background Services.

Such an application needs to be aware of its state when interacting with the user. This might mean updating the Activity UI when it's visible and sending notifications to keep the user updated when it's in the background, as seen in the section on Notifications and Services in Chapter 9.

Was this article helpful?

Recommended Books

Related Posts