search

Home  >  Q&A  >  body text

android-studio - Which information is used to determine whether the Activity defined in AndroidManifest.xml is started by the application by default?

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

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/BlueTheme" >
        <activity
            android:name="com.ucloud.uvod.example.MainActivity"
            android:label="@string/app_name"
            android:launchMode="singleTask"
            android:theme="@style/BlueTheme"
            android:screenOrientation="sensor" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <activity
            android:name="com.ucloud.uvod.example.impl.UEasyPlayerActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/app_name"
            android:launchMode="singleTask"
            android:screenOrientation="sensor"
            android:theme="@style/FullscreenTheme" >

            <intent-filter>
                <action android:name="ucloud.intent.action.uvod.example.easyplayer" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />

                <data android:mimeType="video/*" />
                <data android:mimeType="audio/*" />
                <data android:scheme="http" />
                <data android:scheme="file" />
            </intent-filter>
        </activity>

        <activity
            android:name="com.ucloud.uvod.example.impl.UVideoViewActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/app_name"
            android:launchMode="singleTask"
            android:screenOrientation="sensor"
            android:theme="@style/FullscreenTheme" >

            <intent-filter>
                <action android:name="ucloud.intent.action.uvod.example.uvideoview" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>

        </activity>
        <activity
                android:name="com.ucloud.uvod.example.permission.PermissionsActivity"
                android:screenOrientation="portrait"
                android:launchMode="singleTask"
                android:theme="@style/BlueTheme"/>
    </application>

</manifest>

If configured in Activity

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

the entrance to the program?

天蓬老师天蓬老师2758 days ago1003

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-05-31 10:39:45

    Yes.

    ///MAIN表示是主入口
    <action android:name="android.intent.action.MAIN" />
    ///LAUNCHER表示桌面显示的icon对应的Activity
    <category android:name="android.intent.category.LAUNCHER" />

    MAIN and LAUNCHER can be set to multiple activities at the same time.
    But MAIN only works on the activity declared at the top of the manifest; LAUNCHER works on all set activities, which means you will see multiple icons on the desktop.

    reply
    0
  • Cancelreply