Android Manifest File

Package Name:

Defined using the package attribute.

Should be unique across all applications.

Application Components:

Activities, Services, Broadcast Receivers, Content Providers:

  • Each component is declared within the <application> element.
  • Activities have an additional <activity> element.
  • Services have a <service> element.
  • Broadcast receivers have a <receiver> element.
  • Content providers have a <provider> element.
Intent Filters:
  • Used to specify the types of intents a component can respond to.
  • Defined within each <activity>, <service>, or <receiver> element.
  • Allows components to declare which actions, categories, and data types they can handle.
Permissions:

Declared using the <uses-permission> element.

Specifies the permissions required by the app, such as access to the internet, camera, or contacts.

Application Metadata:

Additional information about the application.

Can include version information, theme settings, and more.

Defined within the <application> element using the <meta-data> element.

Here's a simplified example of an AndroidManifest.xml file:

                      
                        <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapp">

    <!-- Permissions -->
    <uses-permission android:name="android.permission.INTERNET" />

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

        <!-- Main Activity -->
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name">
            <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

        <!-- Other Activities, Services, Broadcast Receivers, Content Providers -->

        <!-- Application Metadata -->
        <meta-data
            android:name="com.example.myapp.API_KEY"
            android:value="your_api_key" />
    </application>
</manifest>