Navigation component seems just working with short dynamic link
Example: Long Dynamic Link
https://domaindebug.page.link/?link=https://www.website.com&am
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.