Android Application Security Testing Part-5: Android Application components
Android Application components
·
App
components are the essential building blocks of an Android app.
·
Each
one is a unique building block that helps define your app’s overall behaviour.
·
There
are four different types of app components:
1)
Activities.
2)
Services.
3)
Broadcast
receivers.
4)
Content
providers.
Activity
·
An
activity represents a single screen with a user interface, simply we can say
"User visible window"
·
For
Example:
1)
One
activity for Login and another activity after login has been successful.
2)
An
email app might have one activity that shows a list of new emails, another
activity to compose an email, and another activity for reading emails.
Services
·
A
service is a component that runs in the background to perform long-running
operations or to perform work for remote processes.
·
A
service does not provide a user interface, neither component, such as an
activity, can start the service and let it run or bind to it in order to
interact with it.
·
For
example, a service might play music in the background while the user is in a
different application, or it might fetch data over the network without blocking
user interaction with an activity.
Content
Provider
·
Content
Provider component supplies data from one application to others on request.
·
You
can store the data in the file system, an SQLite database, on the web, or any
other persistent storage location your app can access.
·
Through
the content provider, other apps can query or even modify the data (if the
content provider allows it).
·
Content
Provider is useful in cases when an app wants to share data with another app.
·
It
is much similar like databases and has four methods.
» insert ()
» update ()
» delete ()
» query ()
Broadcast
Receiver
·
A
broadcast receiver is a component that responds to system-wide broadcast
announcements.
·
Many
broadcasts originate from the system—for example, a broadcast announcing that
the screen has turned off, the battery is low, or a picture was captured.
·
Apps
can also initiate broadcasts—for example, to let other apps know that some data
has been downloaded to the device and is available for them to use.
·
Although
broadcast receivers don’t display a user interface, they may create a status
bar notification to alert the user when a broadcast event occurs.
·
More
commonly, though, a broadcast receiver is just a “gateway” to other components
and is intended to do a very minimal amount of work. For instance, it might
initiate a service to perform some work based on the event.
·
An
application may register a receiver for the low battery message for example,
and change its behaviour based on that information.
Useful Links:
No comments