【发布时间】:2021-02-26 12:58:01
【问题描述】:
我正在使用具有多个活动的多个导航图,并尝试深度链接到特定导航图目标片段,但它正在打开启动器活动
val args = Bundle()
args.putParcelable("parceable",parceableObject)
args.putString("type","type")
val pendingIntent = NavDeepLinkBuilder(applicationContext)
.setGraph(R.navigation.bottom_nav_navigation)
.setDestination(R.id.myFragment)
.setArguments(args)
.createPendingIntent()
这就是我创建 NavDeepLinkBuilder 的方式。
以下是导航图中目的地的样子
<fragment
android:id="@+id/myFragment"
android:name="com.view.brands.MyFragment"
android:label="BrandOffersFragment"
>
<argument
android:name="parceableObject"
app:argType="com.view.brands.ParceableObject"
/>
<argument
android:name="type"
app:argType="string"
/>
<argument
android:name="is_card"
android:defaultValue="false"
app:argType="boolean"/>
<action
android:id="@+id/action_myFragment_to_secondFragment"
app:destination="@id/secondFragment"
>
<argument android:name="secondParceable"
app:argType="com.view.brands.SecondParceable"/>
<argument
android:name="parceableObject"
app:argType="com.view.brands.ParceableObject"
/>
<argument
android:name="type"
app:argType="string"
/>
</action>
<action
android:id="@+id/action__myFragment_to_thirdFragment"
app:destination="@id/ThirdFragment"
>
<argument
android:name="thirdParceable"
app:argType="com.view.network.parceable.ThirdParceable"
/>
</action>
<action
android:id="@+id/action_myFragment_to_thirdActivity"
app:destination="@id/ThirdActivity"
>
<argument
android:name="card"
app:argType="com.network.apiinterface.Card"
/>
<argument
android:name="id"
app:argType="string"
/>
</action>
</fragment>
【问题讨论】:
-
对this 有帮助,如果没有,您能否发布更多信息,例如您的 NavGraph xml 和 R.id.myFragment 的代码?
-
@NikhilSharma 这篇文章没有帮助,我必须从 FirebaseMessagingService 发送带有深层链接的通知,我已经为 NotificationManager 创建了一个扩展函数来发送带有深层链接挂起意图的通知,如上所述。我已经编辑了代码。请看看它是否可以指定问题
标签: android android-notifications android-architecture-navigation