【发布时间】:2021-05-05 14:43:55
【问题描述】:
我一直在使用 Android 的隐式深层链接,并且直接在导航图中定义了深层链接。
问题是当我在下面的配置中使用“启动选项”时,我的深层链接会很好地打开片段,但是当我输入确切的 URL 时它就不起作用(顺便说一句,我尝试使用 http、https 输入,没有它,在笔记应用程序和浏览器中直接)。
你猜为什么会这样?
我的代码的某些部分相关: 导航图:
<fragment
android:id="@+id/usedPriceFragment"
android:name="UsedPriceFragment"
android:label="UsedPriceFragment">
<argument
android:name="clearCache"
android:defaultValue="false"
app:argType="boolean"
app:nullable="false" />
<deepLink
android:id="@+id/deepLink"
app:action="ACTION_VIEW"
app:mimeType="type/subtype"
app:uri="example.com/example/prices/used" />
</fragment>
清单:
<activity
android:name="activity.MainActivity"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<data android:pathPrefix="/example/prices" />
</intent-filter>
<nav-graph android:value="@navigation/navigation_graph_main" />
编辑: 详细版:系统询问我是否要使用我的应用程序打开 URL。我点击是,然后主页启动而不是我要打开的片段。
【问题讨论】:
标签: android android-intent android-architecture-navigation android-deep-link