Junior — Middle
What are the main components used in the AndroidManifest.xml file?
sobes.tech AI
Answer from AI
The main components in the AndroidManifest.xml file include:
- <application> — describes the application, its icons, themes, components, and permissions.
- <activity> — defines an application's screen (activity).
- <service> — describes background services.
- <receiver> — specifies a BroadcastReceiver for handling system or user events.
- <provider> — describes a ContentProvider for data exchange between applications.
- <intent-filter> — specifies which intents a component can receive.
- <uses-permission> — indicates permissions required by the application.
Example:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.app">
<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>
<service android:name=".MyService" />
</application>
</manifest>