Android deeplink两个独立的活动

时间:2016-06-29 06:41:19

标签: android regex android-manifest deep-linking

我有两个深层链接活动

与关注网址链接的一项活动

MSDN

以下是意图过滤器

      <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

<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>

但点击任何网址深层链接都适用于两个活动,这是我如何解决这个问题

1 个答案:

答案 0 :(得分:0)

不幸的是,这是不可能的。 因为路径在两个意图过滤器中都是相同的。

作为替代方案,只为用户提供一个建议

  1. 从第二个活动中删除意图过滤器
  2. 在第一个活动中解析来自intent.getDataString()的URI数据,并根据此数据将用户重定向到第二个活动。
相关问题