Sobes.tech
Junior — Middle

What are the key elements and sections of the AndroidManifest.xml registration file that need to be specified when creating an application?

sobes.tech AI

Answer from AI

The following key elements and sections must be specified in AndroidManifest.xml:

  • <manifest> — the root element, contains attributes like package (the unique application identifier).
  • <application> — describes the application itself, its icon, theme, components, and permissions.
  • <activity> — defines the application's screen (activity), with intent-filters for launching.
  • <service> — describes background services.
  • <receiver> — for BroadcastReceiver, handling system or user events.
  • <provider> — for ContentProvider, providing access to data.
  • <uses-permission> — specifies permissions needed by the app (e.g., internet access).
  • <uses-sdk> — minimum and target SDK versions.

Example of a minimal manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.app">

    <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33" />

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

    <application
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name">

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

    </application>

</manifest>