Tuesday, July 7, 2009

Basic Concept of Android Application Components

Activity
An application may or may not have a User Interface. If it has a user interface, it will have one or more Activity.

Service
If an application is to have a long life cycle it should be put into a Service. For example a background data synchronization utility running continuously should be implemented as a Service.

BroadcastReceiver
Like Services, BroadcastReceivers do not have a User Interface. Of even more importance, the code running in the onReceive method of a BroadcastReceiver should make no assumptions about persistence or long-running operations. If the BroadcastReceiver requires more than a trivial amount of code execution, it is recommended that the code initiate a request to a Service to complete the requested functionality.

Content Provider
If an application manages data and needs to expose that data to other applications running in the Android environment, a ContentProvider should be implemented.


Reference:
Unlocking Android - A Developer's Guide

No comments:

Post a Comment

You can leave any question here and I will make a response to you ASAP. :D