我有两个 Activity 要进行深层链接
一项与关注网址链接的 Activity
http://abc.or/deals
以下是它的 Intent 过滤器
<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>
带有以下网址的另一项 Activity
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 深层链接对这两个 Activity 都有效,这是我如何解决这个问题的问题
最佳答案
不幸的是,这是不可能的。
因为两个 Intent 过滤器中的路径相同。
作为替代方案,只有一个给用户的建议,
intent.getDataString()
的 URI 数据在第一个 Activity 中并根据此数据将用户重定向到第二个 Activity 。 关于Android 深度链接两个单独的 Activity ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38092119/