Android Application component

Abhishek Pathak
3 min readNov 7, 2022

--

Android have 4 different components which are

  1. Activities
  2. Broadcast receiver
  3. Content Provider
  4. Service

Activities

Android activities are the UI component that interact with the user. It allows all the view and viewgroup to display over UI. Mainly it is the fist interacting component of android application.

ByDefault we have one activity got created with project that is also launcher activity.

In Android manifest we have a tag of android activity i.e

<activity android:name="io.sample.movieapp.ui.listing.ListingActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

BroadCast Receiver

Broadcast receiver is an android component that deals with all the system events or custom events to receive. It is very similar to antennas which is always ready to catch new frequencies whenever the satellite broadcast something new. For example when had a receiver for internet or wifi event and suddenly WIFI or internet got connected/disconnected, you will receive a event in your receiver.

<receiver android:name="YourBroadcastReceiverName"/>

Content Provider

Content provider works a central repository and it deals with data in a shared concept. For example contacts, media, images, videos etc can be shared or fetched by all the applications installed in device by the help of this content provider using the mechanism of querying the data.

<provider
android:authorities="your authorities"
android:name="Your content provider name"/>

Service

Services are the android application component that allows you the run the work in background without UI. Services runs on main thread but runs in background. In android servicers are 3 kinds Started , Bound, Foreground service.

<service android:name="YourServiceName"/>

And here your application tag with all 4 component tag inside androidmanifest.xml file.

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:name="io.sample.movieapp.AppClass"
android:theme="@style/Theme.DemoTMDB">

<activity android:name="io.sample.movieapp.ui.listing.ListingActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<receiver android:name="YourBroadcastReceiverName"/>

<service android:name="YourServiceName"/>

<provider
android:authorities="your authorities"
android:name="Your content provider name"/>

</application>

Thanks for reading this article. Be sure to click 👏 below to applause this article if you found it helpful. It means a lot to me.

--

--