When it comes to the name, a mobile application may also be known as an app, online app, smart phone app or web app. Mobile applications, mostly referred to as apps, are nothing but a type of application software. These softwares are designed to run on a mobile device, such as a tablet or a smart phone.
Mobile apps were originally developed to provide their users with services that users accessed on personal computers. To be more precise, an app is generally a small and individual software unit and, therefore, has very limited functionality. Nonetheless, mobile apps have become extremely popular these days, and this trend is only going to get bigger in the future.
The beginning of the popularity can be traced back to the first five hundred apps of Apple App Store, or if we go back further, it goes back to the simple yet addictive Snake game in the 6110 Nokia phone. Since then, many companies have stepped forward and introduced their versions of the mobile app. Out of these companies, many have gained universal acclaim due to their easy to use, attractive and intelligent apps. One such type of app is the Android application.
In 2008, Android Applications were first introduced to the world with the arrival of Android Market, which is known as Google Play Store now. In the initial years, the platform had only sixteen thousand apps; however, the number was only going to rise in the future. Due to the unmatchable usability and remarkable convenience provided by Android apps, a huge population has become attracted to not only use but develop them as well.
Today, the renowned Google Play Store has about 2.87 million Android apps. In addition to that, the apps are highly rated with an average of 4.1 stars out of 5. In 2020, mobile applications are expected to generate revenue of more than 581 billion US dollars, and a huge reason for being able to hit that milestone is going to be Android Applications.
The secret of the unimaginable success of Android Applications is hidden inside them. The essential building blocks, more commonly known as Android Components, of an Android application are the key to the great outcomes. Basically, the Android Components of an application enable it to have numerous qualities to make it highly competent and efficient.
Each of all the Android Components has a specific purpose, which is incredibly crucial for a great app performance. Also, the application manifest file or the AndroidManifest.xml file is responsible for loosely coupling the Android Components. Among other duties, this file describes all the Android Components and how one of them interacts with the rest.
To make it easier to understand, we will divide the Android Components into two categories:
Main Android Components
There are four main Android Components that can be used within an app. These components are:
- Broadcast Receivers
- Content Providers
Basically, an activity represents a single screen with a UI (User Interface). In other words, an activity of an app performs actions on the screen. Therefore, an Android activity is one screen of a UI of an Android app. For better understanding, consider an email app, such as Gmail. Gmail has one activity that shows a list of emails, another activity for composing an email and so on.
Many of you must have noticed that an Android app may contain one or more activities or screens, each with some changes in the UI. One of these activities is known as the main activity that is displayed when the application is launched. After opening the main activity, the app may make it possible for the user to open other activities.
To sum it up, an activity dictates the UI and manages all the interactions a user has with the smart phone screen.
In Android, services are processes taking place in the background. These processes can be executed on an Android device even when no application is visible. For this reason, services do not need any UI.
Android services can be used for many operations. For instance, a service could back up data every hour. Also, a service might play music in the background when the user is working on another application. An Android service could even check a remote server for updates. It may even fetch data over the network without interrupting a user’s interaction with an activity.
In a nutshell, services in Android manage background operations related to an application.
3. Broadcast Receivers
In an Android app, a broadcast receiver only responds to messages. These messages may either come from a different application or from the system.
To give you an idea, an application may initiate a broadcast in order to tell a second application that some data has been downloaded to the device and that the second application can now use the data. The second application, in this example, is the broadcast receiver that intercepts this communication and takes an appropriate action.
An Android app developer implements a broadcast receiver as a subclass of BroadcastReceiver class. Also, in a broadcast receiver, each message is broadcasted as an Intent object.
In short, a broadcast receiver is responsible for handling the communication between the Android operating system and the applications.
4. Content Providers
The last of the main Android Components is the content provider, which transfers data from one application to other applications on request. These requests are managed by Content Resolver class methods. The said data is stored in the database, file system or anywhere else.
To implement a content provider, an Android app developer uses it as a subclass of Content Provider class. Another important point about content providers is that a standard set of APIs must be implemented to enable other apps to perform transactions.
Briefly, one can say that content providers handle data and issues associated with data management.
Additional Android Components
Generally, there are six additional Android Components. Basically, these additional Android Components are used to build the main Android Components, their logic and the wiring between them. These additional components are:
In Android, intents are small objects or messages that an activity passes to the operating system. This is done so that the activity can tell the operating system that a different action or activity is required. For example, when a user chooses to share a photo through a photo app, the app sends an intent to the operating. This intent carries the description of the sharing action. The Android system, then, opens a second application that can share the photo to perform the action.
In simpler words, intents are messages that wire application components together.
A fragment, in an Android app, is literally a fragment of the total UI in an activity. Therefore, a fragment only takes up part of the screen, unlike an activity. A fragment has to be used inside an activity, and one fragment can be used within different activities. Typically, a fragment contains Views and ViewGroups inside it.
Shortly, a fragment represents a portion of UI in an activity.
Layouts are nothing but view hierarchies the handle appearance of views and screen format. In Android development, layout and contents of fragments, ViewGroups and activities are defined by using XML files. These layout XML files are used to specify the GUI (Graphical User Interface) elements a fragment or activity would have. Besides that, these files are also used to specify the style (size, padding, etc.) of the GUI elements.
Basically, Android GUI components are of three types: Activities, Views and View Groups. Views refer to the UI components, such as list forms and buttons, which are drawn on the screen. Other the other hand, a View Group collects a number of Views together. Both Views and View Groups are embedded by an activity or a fragment. If they are nested inside a fragment, the fragment, as we mentioned earlier, would be embedded by an activity.
In Android, resources refer to external elements, such as images, constants and strings, which an application uses. However, these elements are not in the form of any programming language source code.
UI layouts are a type of Android resource. These layouts are created by using a structured tool, like the GUI builder of an IDE, or by hand in XML form. Sometimes, the UI elements work in all kinds of devices. Other times, they need to be tailored for different types of devices. For that, a developer needs to put the resources into resource sets that specify the circumstances under which the resources should be used.
The configuration file of an application is referred to as Manifest file, common written as AndroidManifest.xml file. In the manifest of an Android application, there is information about the app package. This information includes components of the app, such as services, content providers, broadcast receivers and activities.
Apart from that, the manifest is responsible for protecting the app by providing permissions to access any protected parts. Also, it enlists the instrumentation classes that provide profiling and other information. Furthermore, manifest defines the Android API that the application will be using.