Sunday, December 10, 2017

Android Application’s Life Cycle

Cycle Android Applications
1. Activity
An activity usually presents a single visual user interface from which a number of
actions could be performed.
Altough activities work together to form a cohesive user interface, each activity
is independent of the others.
Typically, one of the activities is marked as the first one that should be presented
3
to the user when the application is launched.
Moving from one activity to another is accomplished by having the current
activity start the next one through so called intents.


2. Service
A service doesn't have a visual user interface, but rather runs in the background
for an indefinite period of time.
It's possible to connect to (bind to) an ongoing service (and start the service if it's
not already running).
4
While connected, you can communicate with the service through an interface
that the service exposes.


3. Broadcast receiver
A broadcast receiver is a component that does nothing but receive and react to
broadcast announcements.
Many broadcasts originate in system code (eg. “you got mail“) but any other
applications can also initiate broadcasts.
Broadcast receivers do not display a user interface. However, they may start an
5
p y f , y y
activity in response to the information they receive, or ‐ as services do ‐ they
may use the notification manager to alert the user.


4. Content provider
A content provider makes a specific set of the application's data available to
other applications.
The data usually is stored in the file system, or in an SQLite database.
The content provider implements a standard set of methods that enable other
applications to retrieve and store data of the type it controls.
6
However, applications do not call these methods directly. Rather they use a
content resolver object and call its methods instead. A content resolver can talk
to any content provider; it cooperates with the



Every Android application runs in its own process
(with its own instance of the Dalvik virtual machine).
Whenever there's a request that should be handled by a particular component,
• Android makes sure that the application process of the component is
running,
• starting it if necessary, and
• that an appropriate instance of the component is available, creating the
instance if necessary.

Application’s Life Cycle
A Linux process encapsulating an Android application is created for the
application when some of its code needs to be run, and will remain
running until
1. it is no longer needed, OR
2. the system needs to reclaim its memory for use by other
applications.

Life Cycle Application’s Life Cycle
An unusual and fundamental feature of Android is that an application
process's lifetime is not directly controlled by the application itself.
Instead, it is determined by the system through a combination of
1. the parts of the application that the system knows are running,
2. how important these things are to the user, and
3. how much overall memory is available in the system.







No comments:

Post a Comment

Featured Post

Sistem Informasi Kuis dan Materi (e-learning) 2019