Android 安卓深度链接:如何在清单中使用意图过滤器打开不同的活动?

Android 安卓深度链接:如何在清单中使用意图过滤器打开不同的活动?,android,regex,deep-linking,Android,Regex,Deep Linking,我为3个URL设置了意向过滤器 ->->公开活动A <intent-filter> <data android:scheme="Appname" /> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFA

我为3个URL设置了意向过滤器

->->公开活动A

<intent-filter>
                <data android:scheme="Appname" />
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data
                    android:host="www.example.com"
                    android:pathPrefix="/^/?$"
                    android:scheme="https" />
</intent-filter>

或->打开活动B

<intent-filter android:label="Awign">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data
                    android:host="www.example.com"
                    android:pathPattern="/internships^/?$"
                    android:scheme="https" />
</intent-filter>

{some_path_param}->打开活动C

<intent-filter>
                <data android:scheme="Appname" />
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data
                    android:host="www.example.com"
                    android:pathPrefix="/^/?$"
                    android:scheme="https" />
</intent-filter>

活动A和C按预期打开,如何实现活动B的预期结果

另外,我如何在chrome浏览器搜索中允许深度链接?例如,如果我在搜索结果中有这三个URL。 我说的不是在地址栏中键入URL,而是搜索结果。如其他问题中所述,在地址栏中键入结果无论如何都不会打开应用程序

使用,您应该能够通过添加
$deeplink\u path
简化此过程。这将允许您在不依赖正则表达式的情况下处理深层活动

要进行设置,您的清单只需包括以下内容:

   <activity android:name="com.yourapp.your_activity">
         <!-- App Link your activity to Branch links-->
         <intent-filter android:autoVerify="true">
            <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="yourapp-alternate.app.link" />
            <data android:scheme="https" android:host="yourapp.app.link" />
         </intent-filter>
    </activity>
使用,您应该能够通过添加
$deeplink\u path
来简化此过程。这将允许您在不依赖正则表达式的情况下处理深层活动

要进行设置,您的清单只需包括以下内容:

   <activity android:name="com.yourapp.your_activity">
         <!-- App Link your activity to Branch links-->
         <intent-filter android:autoVerify="true">
            <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="yourapp-alternate.app.link" />
            <data android:scheme="https" android:host="yourapp.app.link" />
         </intent-filter>
    </activity>