The 4 pillars of Android Ecosystem or Android Components
An oberview of the essential compoents of android application.
The Android system is complex and made up of many components that handle many things. Basically, the android application has 4 pillars as the main component, which are used by almost every application that runs on the android platform.
They are:
- Activity
- Services
- Broadcast Receivers
- Content Providers
Before starting android development you must know about these android components, not mastered but a simple clear idea is a good way to kickstart your journey.
1. Activity :
Activity
is what you see on an application, hence it is a crucial part of an Android xD. This is a UI component
. An activity represents a single screen with some actions the user can perform over the screen. The Android system starts the screen by instantiating Activity Class
with a few callbacks, unlike some programming languages that start with main()
block. The activity class has exposed some callbacks i.e (onCreate()
, onStart()
,onResume()
, onPause()
, onStop()
and onDestroy()
) in which we can implement the logic we needed at any particular stage of our application.
Intent
is also an important component of android, for applications that contain more than one screen. It helps to move between screens/Activity.
2. Service:
Service
is a special component of android, it helps to run long-running tasks in the background, like downloading a file, playing music, etc. The primary goal of the service is to keep running the job even after the user kills the application or switches to other. Additionally, the application component can bind itself to a service, to perform inter-process communication(IPC).
Service
in android is of three types:
- Foreground Service
- Background Service
- Bound Service
3. Broadcast Receiver:
Broadcast in android is a messaging system across apps i.e out of user access. It occurs when some event happens, and apps can receive and respond to that event. An event can be system boot-up, receiving calls, notifications, etc.
Broadcast receivers allow us to register our app to receive a broadcast. When an event happens the system notifies all the apps that have subscribed to that particular event.
Broadcast receivers is of two types:
- Static Broadcast Receivers
- Dynamic Broadcast Receivers
4. Content Provider
Content provides helps us to access the central repository of data. The content provider component provides data from one application to another. Whatsapp access to our contact list is an example of a content provider.
Ps: Thanks for reaching the end. Wish you a great android journey ahead ❤.