微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Android深层链接-使用相同的网址进行多次重定向

如何解决Android深层链接-使用相同的网址进行多次重定向

在我的应用程序中,我使用深层链接导航到“特殊活动”。我想导航到具有相同basePrefix且末尾具有不同上下文路径的不同活动。

<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="https"
                android:host="www.mycompany.com"
                android:pathPrefix="/profile/friendslist"/>
        </intent-filter>


 <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="https"
                android:host="www.mycompany.com"
                android:pathPrefix="/profile/friendslist/details"/>
        </intent-filter>

./ adb shell开始-a android.intent.action.VIEW -c android.intent.category.broWSABLE -d“ https://www.mycompany.com//profile/friendslist” com.mycompany.sample :它启动FriendsListFragment

./ adb shell开始-a android.intent.action.VIEW -c android.intent.category.broWSABLE -d“ https://www.mycompany.com//profile/friendslist/details” com.mycompany .sample:它还会启动FriendsListFragment而不是FriendsListDetailsFragment

我想做的是

/ profile / friendslist /:应该打开 FriendsList

/ profile / friendslist / details?id = 1234 应导航至FriendDetails

有人建议我们如何利用android:pathPrefix根据上下文路径导航到不同的屏幕吗?

解决方法

您可以在前一个ReactReduxContext中选择pathPattern

intent-filter

$ 表示字符串的结尾,这将删除“ / profile / friendslist / details”大小写

或者,宁可选择<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="https" android:host="www.mycompany.com" android:pathPattern="/profile/friendslist$"/> </intent-filter> ,它会查找完全匹配的内容。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。