如何修复未将应用程序图标显示到应用程序抽屉中?

Dr.*_*ake 2 java android deep-linking android-deep-link

在我的应用程序中,我想使用deeplink。当添加intent-filter深层链接启动activity不见了应用程序图标到应用程序抽屉里
但是当删除深层链接 时,将intent-filter应用程序图标显示到应用程序抽屉中

清单代码:

<activity android:name=".Pages.Splash.SplashPage">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
        <!-- DeepLink -->
        <action android:name="android.intent.action.VIEW" />

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <data
            android:host="www.example.com"
            android:pathPrefix="/gaming"
            android:scheme="http" />
        <data
            android:host="example.com"
            android:pathPrefix="/gaming"
            android:scheme="http" />

    </intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)

使用以上代码时,不在应用程序抽屉中显示应用程序图标,而是从manifest显示图标中删除以下代码时。

        <!-- DeepLink -->
        <action android:name="android.intent.action.VIEW" />

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <data
            android:host="www.example.com"
            android:pathPrefix="/gaming"
            android:scheme="http" />
        <data
            android:host="example.com"
            android:pathPrefix="/gaming"
            android:scheme="http" />
Run Code Online (Sandbox Code Playgroud)

我想当打开用户点击链接时,首先启动启动activity,然后动态打开另一个activity.

我该如何解决?

Chi*_*oni 7

您应该创建两个单独的意图过滤器。在您的<activity/>标签中尝试以下代码:

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

    <!-- DeepLink -->
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <data
            android:host="www.example.com"
            android:pathPrefix="/gaming"
            android:scheme="http" />
        <data
            android:host="example.com"
            android:pathPrefix="/gaming"
            android:scheme="http" />

    </intent-filter>
Run Code Online (Sandbox Code Playgroud)

最后,您的代码将如下所示:

<activity android:name=".Pages.Splash.SplashPage">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

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

    <!-- DeepLink -->
    <intent-filter>

        <action android:name="android.intent.action.VIEW" />

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <data
            android:host="www.example.com"
            android:pathPrefix="/gaming"
            android:scheme="http" />
        <data
            android:host="example.com"
            android:pathPrefix="/gaming"
            android:scheme="http" />

    </intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)