导航组件似乎仅适用于短动态链接(firebase) [英] Navigation component seems just working with short dynamic link (firebase)

查看:91
本文介绍了导航组件似乎仅适用于短动态链接(firebase)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

导航组件似乎仅适用于短动态链接

Navigation component seems just working with short dynamic link

示例: 长动态链接

https://domaindebug.page.link/?link=https://www.website.com&apn=com.x.debug&isi=122...6&ibi=com.ios.x.debug&efr=1

短动态链接

https://domaindebug.page.link/register

<fragment
        android:id="@+id/fragment_register"
        android:name="com.x.presentation.feature.identification.view.RegisterFragment"
        tools:layout="@layout/fragment_register">
        <action
            ... />
        <argument
            android:name="code"
            android:defaultValue="@null"
            app:argType="string"
            app:nullable="true" />
        <deepLink
            android:id="@+id/deepLink"
            app:uri="https://domaindebug.page.link/register?code={code}" />
</fragment>

如果我单击长动态链接,则什么也没有发生. 我该如何处理?我也找不到任何有关集成Firebase动态Deeplink +导航组件的文档

If I click on long dynamic link, nothing happens. How can I manage this? I also can't find any documentation about integrate firebase dynamic deeplink + navigation component

推荐答案

到目前为止,我还没有看到动态链接与导航组件的任何正式集成.但是通过在FirebaseDynamicLinks的帮助下获取链接并将其传递给NavController:

I have not seen any official integration of dynamic links with the navigation component so far. But it's pretty simple to integrate them manually by fetching the link with help of FirebaseDynamicLinks and passing it to the NavController:

FirebaseDynamicLinks.getInstance()
            .getDynamicLink(intent)
            .addOnSuccessListener(this) { link ->
                findNavController(R.id.nav_host_fragment).handleDeepLink(Intent().apply {
                    data = link?.link
                })
            }

请查看我创建的示例项目.它在单独的活动中处理深层链接以使UI更加平滑,但将链接移交给导航组件进行处理.

Please check out the sample project I've created to show the idea. It handles deep links in a separate activity to make UI smoother, but hands over the link to the navigation component for handling.

这篇关于导航组件似乎仅适用于短动态链接(firebase)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆