Android

WHAT MAKES AN ANDROID APPLICATION?

Android applications consist of loosely coupled components, bound by an application manifest that describes each component and how they all interact, as well as the application metadata including its hardware and platform requirements. The following six components provide the building blocks for your applications:

➤ Activities Your application’s presentation layer. Every screen in your application will be an extension of the Activity class. Activities use Views to form graphical user interfaces that display information and respond to user actions. In terms of desktop development, an Activ- ity is equivalent to a Form. You’ll learn more about Activities later in this chapter.

➤ Services The invisible workers of your application. Service components run in the background, updating your data sources and visible Activities and triggering Notifica- tions. They’re used to perform regular processing that needs to continue even when your application’s Activities aren’t active or visible. You’ll learn how to create Services in Chapter 9.

➤ Content Providers Shareable data stores. Content Providers are used to manage and share application databases. They’re the preferred means of sharing data across application bound- aries. This means that you can configure your own Content Providers to permit access from other applications and use Content Providers exposed by others to access their stored data. Android devices include several native Content Providers that expose useful databases like the media store and contact details. You’ll learn how to create and use Content Providers in Chapter 7.

➤ Intents An inter-application message-passing framework. Using Intents you can broadcast messages system-wide or to a target Activity or Service, stating your intention to have an action performed. The system will then determine the target(s) that will perform any actions as appropriate.

➤ Broadcast Receivers Intent broadcast consumers. If you create and register a Broad- cast Receiver, your application can listen for broadcast Intents that match specific filterIntroducing the Application Manifest ❘ 51 criteria. Broadcast Receivers will automatically start your application to respond to an incoming Intent, making them perfect for creating event-driven applications.

➤ Widgets Visual application components that can be added to the home screen. A special variation of a Broadcast Receiver, widgets let you create dynamic, interactive application components for users to embed on their home screens. You’ll learn how to create your own widgets in Chapter 10.

➤ Notifications A user notification framework. Notifications let you signal users without stealing focus or interrupting their current Activities. They’re the preferred technique for getting a user’s attention from within a Service or Broadcast Receiver. For example, when a device receives a text message or an incoming call, it alerts you by flashing lights, making sounds, displaying icons, or showing messages. You can trigger these same events from your own applications using Notifications, as shown in Chapter 9. By decoupling the dependencies between application components, you can share and interchange indi- vidual pieces, such as Content Providers, Services, and even Activities, with other applications — both your own and those of third parties.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s