【问题标题】:Using Android deeplinking with the end of URL使用带有 URL 结尾的 Android 深层链接
【发布时间】:2019-09-06 13:14:42
【问题描述】:

我想把所有链接看起来像这样的深层链接:

https://myapp.com/*/*/quiz.html

我该怎么做?我在我的清单中尝试了这个intent-filter,但 pathPrefix 不起作用:

 <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:scheme="https"
                      android:host="myapp.com"
                      android:pathPrefix="/.*/.*/quiz\\.html"/>
 </intent-filter>

没有android:pathPrefix 它可以工作,但它会打开来自https://myapp.com 的所有链接。

【问题讨论】:

    标签: android deep-linking intentfilter


    【解决方案1】:

    您必须在数据元素中使用android:pathPattern

    <data
         android:host="myapp.com"
         android:pathPattern="/.*/.*/quiz.html"
         android:scheme="https" />
    

    然后,您可以设置要在应用中打开的任何 url 模式。阅读documentation。此外,here 很好地解释了它的工作原理。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-12-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-13
      • 2023-03-17
      • 1970-01-01
      相关资源
      最近更新 更多