Navigation component seems just working with short dynamic link (firebase)

此生再无相见时 提交于 2019-12-02 02:06:47

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
                })
            }

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!