Deeplink意图过滤到特定的pathPrefix?

xan*_*xan 5 android deep-linking

我在我的Android应用程序上启用了深层链接,它运行正常.

但是,我希望intent-filter只听一个特定的pathPrefixie http(s)://(www.)mydomain.com/e而不是任何其他的pathPrefix.

这可能吗?我正在附加我的intent-filter代码AndroidManifest.xml

<intent-filter android:label="My 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:scheme="http"
                android:host="www.domain.com"
                android:pathPrefix="/e" />
            <data android:scheme="http"
                android:host="mydomain.com"
                android:pathPrefix="/e" />
            <data android:scheme="https"
                android:host="www.mydomain.com"
                android:pathPrefix="/e" />
            <data android:scheme="https"
                android:host="mydomain.com"
                android:pathPrefix="/e" />
</intent-filter> 
Run Code Online (Sandbox Code Playgroud)

Mim*_*oli 4

通过该清单,您可以告诉您的设备启动包含该意图过滤器的 Activity,其中的所有 url 都具有

  1. http 或 https 作为协议
  2. www.mydomain.com 或 mydomain.com 作为主机
  3. /e 作为路径的前缀

由于问题与pathPrefix相关,因此您的活动将处理路径以/e开头的所有网址。例如:

  • http(s)://(www.)mydomain.com/e - 匹配
  • http(s)://(www.)mydomain.com/eXXX - 匹配
  • http(s)://(www.)mydomain.com/e/a - 匹配
  • http(s)://(www.)mydomain.com/eXXX/a - 匹配
  • http(s)://(www.)mydomain.com/e?a=b - 匹配
  • http(s)://(www.)mydomain.com/Xe - 不匹配
  • http(s)://(www.)mydomain.com/X/e?a=b - 不匹配