android - 使用 URL 结尾的深度链接

标签 android deep-linking

我已经可以使用深层链接,但我遇到的问题是,根据 URL 中的最后一个元素,我必须将用户重定向到应用程序的不同部分。

所以现在我正在使用“http://www.mypage.com/us/en/order.html ”,但我们位于多个国家/地区,因此它也可能是“http://www.mypage.co.uk/uk/en/order.html ”。

我想要做的是捕获最后一个元素(order.html)并使用它进行深层链接。

下面是我目前拥有的,但它捕获了所有浏览器 Activity

<activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:launchMode="singleTask"
            android:screenOrientation="portrait"
            android:taskAffinity="com.mypage.app"
            android:theme="@style/AppTheme"
            android:windowSoftInputMode="adjustPan">
            <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="mypagemobileapp"/>
                <data android:scheme = "http"
                    android:host="www.mypage.com"/>
            </intent-filter>
        </activity>

最佳答案

查看数据元素的文档:http://developer.android.com/guide/topics/manifest/data-element.html

您可以为 url 的路径指定模式。在您的情况下,您应该使用类似以下内容

<data android:scheme="http"/>
<data android:host="www.mypage.com"/>
<data android:host="www.mypage.co.uk"/>
<data android:pathPattern=".*/.*/order\\.html"/>

匹配页面的所有国家/语言组合。如果您必须匹配其他页面,您可以相应地调整模式。

关于android - 使用 URL 结尾的深度链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35923102/

相关文章:

firebase - 带有推送通知的深层链接 - FCM - Android

javascript - 如何在Android上转换手机网页?

android - 发送短信导致一般性失败

连接到地址的 Android 网络错误

android - 使用Android二进制文件使用openCV Matrix裁剪图像

android - Google plus 帖子中的链接和图片

java - 在 Android TabHost 应用程序中完成交互通信的最佳方式

ionic-framework - 如何从 Ionic 5 中的推送通知打开应用程序 + 特定网址?

android - 我们如何从 Intent 中删除深层链接数据

android - 使用 React-Native 监听 Android 上的传入链接