Every Android application package must have an AndroidManifest.xml file located at the root of its source set (app/src/main/AndroidManifest.xml). The manifest acts as the formal contract between your application and the underlying Android operating system. Before Android launches a process, displays an activity, or delivers a notification, it inspects this file.
Here is a realistic, production-ready manifest demonstrating modern configuration best practices:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<!-- Normal Permissions (Granted automatically at install time) -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Dangerous Permissions (Requires runtime prompt on Android 6.0+) -->
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<!-- Hardware Feature Declarations -->
<uses-feature
android:name="android.hardware.camera"
android:required="false" /> <!-- App will still install on devices without camera -->
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.VeewomApp"
android:enableOnBackInvokedCallback="true"
tools:targetApi="35">
<!-- Launcher Activity (The entry point when user taps app icon) -->
<activity
android:name=".MainActivity"
android:exported="true"
android:theme="@style/Theme.VeewomApp">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Detail Activity (Internal component, not exported to other apps) -->
<activity
android:name=".DetailActivity"
android:exported="false"
android:parentActivityName=".MainActivity" />
<!-- Background Work Service -->
<service
android:name=".services.DownloadService"
android:exported="false" />
<!-- Broadcast Receiver for Network Changes -->
<receiver
android:name=".receivers.NetworkChangeReceiver"
android:exported="false" />
</application>
</manifest>
| Attribute / Element | Allowed Values | Security & Architectural Importance |
|---|---|---|
| android:exported | true | false |
Mandatory since Android 12! Determines whether external apps and the OS can invoke this component. Setting true without intent filters or permissions is a severe security vulnerability. |
| android:required (in uses-feature) | true | false |
If set to true, Google Play Store hides your app from any device lacking that specific hardware sensor (e.g., tablets without telephony). |
| enableOnBackInvokedCallback | true | false |
Enables modern Predictive Back system animations introduced in Android 13/14+. |
| intent-filter | action, category, data | Tells the operating system what types of explicit and implicit requests (e.g., opening a URL, sharing text) this component can handle. |
Prior to Android 12, components with intent-filters were exported by default. This allowed malicious third-party apps on the user's phone to launch private internal activities or bind to unprotected background services. Today, any component with an intent-filter must explicitly declare android:exported="true", and any purely internal component must declare android:exported="false".
Broaden your foundational and advanced Android application development skills across our curriculum:
Register Activity declarations, launch modes, and theme attributes.
Declare normal and dangerous permissions and handle runtime requests.
Configure intent-filter tags with android:autoVerify for App Links.
Register FirebaseMessagingService and notification channels in the manifest.