[英]Android deep links - Multiple re-direct with same url
In my application i am using deep links to navigate to Particular activity.在我的应用程序中,我使用深层链接导航到特定活动。 I want to navigate to different activities with same basePrefix with different context path at end.
我想导航到具有相同 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 am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://www.mycompany.com//profile/friendslist" com.mycompany.sample: It launches FriendsListFragment ./adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://www.mycompany.com//profile/friendslist" com.mycompany.sample: 它启动好友列表片段
./adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://www.mycompany.com//profile/friendslist/details" com.mycompany.sample: It also launches FriendsListFragment instead of FriendsListDetailsFragment ./adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://www.mycompany.com//profile/friendslist/details" com.mycompany.sample:它还启动 FriendsListFragment 而不是 FriendsListDetailsFragment
What i want to do is我想做的是
/profile/friendslist/: should open FriendsList /profile/friendslist/: 应该打开FriendsList
/profile/friendslist/details?id=1234 should navigate to FriendDetails /profile/friendslist/details?id=1234应该导航到 FriendDetails
Anyone suggest how we make use of android:pathPrefix to navigate to different screens based on context path?有人建议我们如何使用 android:pathPrefix 根据上下文路径导航到不同的屏幕吗?
You may opt for a pathPattern
in the first intent-filter
您可以在第一个
intent-filter
中选择pathPattern
<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>
The $ indicates end of string, which would drop the "/profile/friendslist/details" case $表示字符串结尾,这将删除“/profile/friendslist/details”案例
OR Rather, go for android:path="/profile/friendslist"
which looks for an exact match.或者更确切地说, go for
android:path="/profile/friendslist"
寻找完全匹配。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.