Interview QuestionPractical QuestionFollow-up Questions

The Role of the AndroidManifest File

skydovesJaewoong Eum (skydoves)||8 min read

The Role of the AndroidManifest File

The AndroidManifest.xml file is a required configuration file in every Android project. It declares essential information about the application to the Android operating system, acting as a bridge between the app and the system. The OS reads this file during installation and at runtime to understand the app's structure, capabilities, and requirements. By the end of this lesson, you will be able to:

  • Explain how the manifest declares application components such as Activities, Services, Broadcast Receivers, and Content Providers.
  • Describe how permissions are declared and how the system enforces them.
  • Identify how intent filters allow components to respond to implicit intents.
  • Explain how hardware and software feature declarations affect device compatibility on the Play Store.

Application Components Declaration

The manifest registers every major component the app uses. Activities, Services, Broadcast Receivers, and Content Providers must all be declared so the system knows how to instantiate and interact with them. Without a declaration, the system cannot launch a component, even if the class exists in the APK.

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme">

    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <service android:name=".MyService" />
    <receiver android:name=".MyBroadcastReceiver" />
    <provider android:name=".MyContentProvider"
        android:authorities="com.example.provider" />
</application>

Each component tag tells the system about the component's class name, its exported status, and any intent filters it responds to. The launcher activity is identified by the combination of android.intent.action.MAIN and android.intent.category.LAUNCHER in its intent filter.

Permissions and Security

The manifest declares which system resources and capabilities the app needs access to. Users are informed about these requirements before installation or at runtime depending on the API level. Permissions such as INTERNET, ACCESS_FINE_LOCATION, and READ_CONTACTS are declared at the top level of the manifest.

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
</manifest>

Starting from API 23, dangerous permissions also require a runtime request through the permission APIs. The manifest declaration alone is not sufficient for these categories, but the declaration is still required as a prerequisite.

This interview continues for subscribers

Subscribe to Dove Letter for full access to exclusive interviews about Android and Kotlin development.

Become a Sponsor