Junior — Middle
Can you explain what a Manifest is and what it is used for in Android development?
sobes.tech AI
Answer from AI
The Manifest in Android is an XML file (AndroidManifest.xml) that is a mandatory part of every Android application. It contains important information for the system about the app:
- Defines the package name of the application.
- Describes the application's components: activities, services, broadcast receivers, content providers.
- Specifies the permissions the app requests, such as internet access or camera.
- Sets the minimum and target SDK versions.
- Defines intent filters for components so the system knows how to launch the app.
Example of a Manifest fragment:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.app">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:label="MyApp"
android:icon="@mipmap/ic_launcher">
<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>
Thus, the Manifest serves as the application's manifest, informing the Android system how to launch and manage the app.