O'Reilly logo

Programming Android by Zigurd Mednieks, G. Blake Meike, Masumi Nakamura, Laird Dornin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Other Android Components

Three other components in Android contribute to applications: services, content providers, and broadcast receivers. The Service class supports background functions. The ContentProvider class provides access to a data store for multiple applications, and the Broadcast Receiver allows multiple parties to listen for intents broadcast by applications.

You will find that, compared to its components, the application itself is a relatively unimportant unit. Well-designed applications “dissolve” into the Android environment, where they can start activities in other applications to borrow their functions, and provide or augment their own functionality through the use of supporting Android components. You can think of Android's content providers and intents as a secondary API that you should learn to use in order to take advantage of Android's strongest features and integrate seamlessly with the Android platform.

Service

The Android Service class is for background tasks that may be active but not visible on the screen. A music-playing application would likely be implemented as a service in order to continue to play music while a user might be viewing web pages. Services also allow applications to share functions through long-term connections. This practice is reminiscent of Internet services such as FTP and HTTP, which wait until a request from a client triggers them. The Android platform avoids reclaiming service resources, so once a service starts, it is likely to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required