Components of an Android Application

30 Apr, 2021
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:
Activities are said to be the presentation layer of our applications. The UI of our application is built around one or more extensions of the Activity class. By using Fragments and Views, activities set the layout and display the output and also respond to the user’s actions. An activity is implemented as a subclass of class Activity. 
Java
Kotlin
public class MainActivity extends Activity {}
class MainActivity : AppCompatActivity() {}
To read more, refer to the article: Introduction to Activities in Android
Services are like invisible workers of our app. These components run at the backend, updating your data sources and Activities, triggering Notification, and also broadcast Intents. They also perform some tasks when applications are not active. A service can be used as a subclass of class Service: 
Java
Kotlin
public class ServiceName extends Service {}
class ServiceName : Service() {}
To read more, refer to the article: Services in Android with Example
It is used to manage and persist the application data also typically interacts with the SQL database. They are also responsible for sharing the data beyond the application boundaries. The Content Providers of a particular application can be configured to allow access from other applications, and the Content Providers exposed by other applications can also be configured. A content provider should be a sub-class of the class ContentProvider.  
Java
Kotlin
public class contentProviderName extends  ContentProvider {   public void onCreate(){}}
class contentProviderName : ContentProvider() {  override fun onCreate(): Boolean {}}
To read more, refer to the article: Content Providers in Android with Example
They are known to be intent listeners as they enable your application to listen to the Intents that satisfy the matching criteria specified by us. Broadcast Receivers make our application react to any received Intent thereby making them perfect for creating event-driven applications.
To read more, refer to the article: Broadcast Receiver in Android With Example
It is a powerful inter-application message-passing framework. They are extensively used throughout Android. Intents can be used to start and stop Activities and Services, to broadcast messages system-wide or to an explicit Activity, Service or Broadcast Receiver or to request action be performed on a particular piece of data.
To read more, refer to the article: Intent and Intent Filters
These are the small visual application components that you can find on the home screen of the devices. They are a special variation of Broadcast Receivers that allow us to create dynamic, interactive application components for users to embed on their Home Screen.
Notifications are the application alerts that are used to draw the user’s attention to some particular app event without stealing focus or interrupting the current activity of the user. They are generally used to grab user’s attention when the application is not visible or active, particularly from within a Service or Broadcast Receiver. Examples: E-mail popups, Messenger popups, etc.
To read more, refer to the article: Notifications in Android with Example
AmiyaRanjanRout
aashaypawar
Android
Android
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Add Views Dynamically and Store Data in Arraylist in Android?
Android RecyclerView in Kotlin
Android SDK and it's Components
Broadcast Receiver in Android With Example
How to Communicate Between Fragments in Android?
Navigation Drawer in Android
Flutter - Custom Bottom Navigation Bar
How to Create and Add Data to SQLite Database in Android?
How to Update Gradle in Android Studio?
Content Providers in Android with Example