So I have this navigation graph, and I'm implementing a deeplink to different fragments once the NEXT buton is pressed on the mainFragment.
However I encountered 2 problems:
If I call for example:
val deeplink = findNavController()
.createDeepLink()
.addDestination(R.id.fragmentNo5)
.createPendingIntent()
deeplink.send()
The app goes from
mainFragment -> fragmentNo5
, and when I click back it returns to mainFragment instead offragmentNo2
.Then I tested opening the fragment8 which is not even in the path by actions, and it could still open it
mainFragment -> fragmentNo8
I could even add more destinations to do something as the following, which should be illegal:
mainFragment -> fragmentNo8 -> otherFragment
So I see no purpose on using deeplink this way, or is it simply a way to construct the path that I need to still know and program?
val deeplink = findNavController()
.createDeepLink()
.addDestination(R.id.otherFragment)
.addDestination(R.id.fragmentNo1)
.addDestination(R.id.fragmentNo2)
.addDestination(R.id.fragmentNo3)
.createPendingIntent()
deeplink.send()