Deep Linkng:使用相同主机但路径不同

时间:2016-11-15 13:10:03

标签: android performance android-layout android-studio deep-linking

我在我的应用程序中使用Deep Linking。但是,现在我要求在两个单独的网址上打开两个单独的应用程序但是同样的主机像

http:www.google.com/Nexus5 - This should open App1

http:www.google.com/Nexus6 - This should open App2

以上网址会打开这两个应用,但我的要求是,如果我提供完整的网址,例如http:www.google.com/Nexus5,那么它应该只显示App1的选项。

所以,就像我传递url

一样
  • http:www.google.com/Nexus5然后只能打开Nexus5应用并显示浏览应用的选项。应该没有选项可以打开Nexus6应用程序。
  • http:www.google.com/Nexus6的同样方式如果我打开Nexus6网址,则不应显示Nexus5 App的选项。

以下是该活动的AndroidManifest文件,

<activity
            android:name=".DeepLinkDemo"
            android:label="@string/app_name">
            <intent-filter android:label="@string/app_name">
                <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.google.com"
                    android:pathPrefix="/Nexus5"
                    android:scheme="http" />
            </intent-filter>
        </activity>

现在,这将运行良好,但如果有任何其他应用程序使用相同的主机意味着www.google.com我想限制该应用程序显示在可浏览列表中(其他应用程序也将由我控制)< / p>

那么,无论如何要实现我的上述要求吗?

让我知道是否有人有任何疑问!

1 个答案:

答案 0 :(得分:0)

您可以使用android:pathPattern唯一地标识不同的应用程序