【发布时间】:2016-10-31 17:16:55
【问题描述】:
我有两个要深层链接的活动
一个与关注网址链接的活动
以下是它的意图过滤器
<intent-filter>
<data
android:host="abc.or"
android:path="/deals"
android:scheme="http" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
另一个带有以下网址的活动
http://abc.or/deals?category=Air+Conditioner-Refrigerator-
<intent-filter>
<data
android:host="abc.or"
android:path="/deals"
android:pathPattern="*deals/?category*"
android:scheme="http" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
但是点击任何 url 深层链接对这两个活动都有效,这是我如何解决这个问题的问题
【问题讨论】:
-
据我所知,您需要为意图过滤器设置一个活动,当您通过您的 URL 获得该活动的深层链接时,您需要决定重定向特定活动
-
不要将路径与 pathPattern 一起使用。仅将后者用于第二个意图过滤器。还有
android:pathPattern="deals/.*"
标签: android regex android-manifest deep-linking