[email protected] 9019854583

COMPONENTS OF AN ANDROID APPLICATION

This Blog will make you understand what an android application is and the various components that make up an android application.

An android application comprises four essential components and some additional components. The four components serve a specific purpose and have a specific lifecycle. They define a path for both user and system to how they can start or leave an application

Four components are essential for any Android-based application. Namely,

  1. Activities
  2. Services
  3. Broadcast Receivers
  4. Content Providers

There are some necessary building blocks that an Android application consists of. These loosely coupled components are bound by the application manifest file which contains the description of each component and how they interact. The manifest file also contains the app’s metadata, its hardware configuration, and platform requirements, external libraries, and required permissions. There are the following main components of an android app:

COMPONENTS-OF-AN-ANDROID-APPLICATION

1. Activities
  • An activity is the first steppingstone is building an Android user application. It provides the space to the user for doing anything and everything. For example, opening a contact, dialing a caller, etc. everything is done by interacting with a window and that very window is provided by an activity.
  • A window is provided to each activity where user interfacing is done. Generally, every Android application has more than one activity. There is one “main” activity. All other activities are child activities. There is a stack called back stack. Whenever, there is a new window is started, previous activity is pushed to the back stack and it is stopped until the new activity is done. As soon as the back key of your device is pressed, new activity is popped out of stack and destroyed. Now previous activity resumes.
COMPONENTS-OF-AN-ANDROID-APPLICATION

2. Services
  • Android services are background processes that can be executed on an Android device, even if no application is visible. Services do not need a user interface. A service could for instance check a remote server for updates, or backup data every hour etc. 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.
  • The operation of the service does not depend on any user interface, even if the program is switched to the background, or the user opens another application, the service can still maintain normal operation.
3. Content Providers
  • Content providers can use it to share their own data for external calls and provide data access interfaces for third-party applications.
  • The Android platform provides a Content Provider to make a specified data set of an application available to other applications. Other applications can obtain or store data from the content provider through the ContentResolver class.
  • Content providers are only needed if data needs to be shared among multiple applications. For example, address book data is used by multiple applications and must be stored in a content provider. Its advantage is a unified data access method.
  • Content Provider implements data sharing. Content Provider is used to save and retrieve data and make it visible to all applications. This is the only way to share data between different applications, because android does not provide a common storage area for all applications to access
4. Broadcast Receivers
  • A Broadcast Receiver is a type of component that listens for system messages called Intents. An Intent can be thought of as a request for a certain action to take place. Apps can create Intents and either send them directly to a specific component (usually an Activity or a Service) or broadcast them system-wide to all apps that are running.
  • A Broadcast Receiver is a component that can receive these systemwide broadcasts and act upon them; it can choose to listen for all broadcast Intents or set up filters so that it receives only Intents for the specific actions it cares about (and would, presumably, take action upon). As with most broadcast systems, more than one Broadcast Receiver can receive, and act upon, a single Intent.
ADDITIONAL COMPONENTS OF ANDROID APPLICATION

Some additional components of an android application:

1. Intents

It is an inter-application message passing framework for communication between android components. It is also used for transferring data between different Activities as well as to start a new service and display a list of contacts in ListView. Example – the camera application sends an intent to the operating system when the user decides to share a picture.

2. Widgets

Widgets are variations of Broadcast Receivers and essential aspects of home screen customization. They display data and allow users to perform actions on them. There are various types of widgets:

  • Information widget: These widgets display crucial information and track how the information changes over time. Example – Clock widgets and widgets that display weather and time information.
  • Collection widget: As the name depicts, collection widgets are a collection of information of the same type. Its use is for browsing information and opening any one of the elements to view details. Example – music widgets, as we can skip pause and play music outside the music application.
  • Control widget: These widgets display functionalities and by using them, the user can trigger from home screen without opening the application. Example – pause and play the video outside the application.
  • Hybrid widget: These widgets combine features of all the other three widgets. Example – music player widget is a control widget but it also informs the user about which track is playing currently, which means it is a combination of control and information thus it is termed as hybrid widget.
3. Views

View is responsible for drawing and event handling. They are rectangular elements on the screen. Some of the views areEditText, ImageView Button, CheckBox and ImageButton.

4. Notifications

It alerts users when the application is not visible or is inactive. This alert flashes on the screen and then disappears. Example – Notification of the new incoming message popped on the screen.

5. Fragments

A fragment is a portion of the total user interface. Users can combine more than one fragment in a single activity and these fragments can be reused in multiple activities. A fragment generally contains Views and ViewGroups inside them.

6. Layout XML Files

Layout is the structure for the user interface in the application. XML files provide different types of layouts for the different type of screen, it also specifies which GUI component, an activity or fragment holds.

7. App APK files

Apk file is the package file format that contains the program’s code, resources, assets. The Android operating system uses them for installing mobile applications and middleware.

8. Resources

Resources in Android is for defining Images, texts, string values. Everything is defined in the resource file and it can be referenced within the source code. We will learn about Android Resources, in detail in our next upcoming article on Resources.

SUMMARY

In this Android tutorial, we studied basic Android’s Application components and some additional components used for android application development.

Introduction to Mobile Application Penetration Testing - Part 1