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

前端 未结 1 834
鱼传尺愫
鱼传尺愫 2021-01-20 23:37

Navigation component seems just working with short dynamic link

Example: Long Dynamic Link

https://domaindebug.page.link/?link=https://www.website.com&am         


        
相关标签:
1条回答
  • 2021-01-21 00:19

    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.

    0 讨论(0)
提交回复
热议问题