I am trying to pass audio file location(/storage/emulated/0/Android/media/...
) as string from first screenhome_screen
to second screendetail_screen
,
When I pass normally above string as a parameter I am getting this error
java.lang.IllegalArgumentException: Navigation destination that matches request NavDeepLinkRequest{ uri=android-app://androidx.navigation/detail_screen/45193/'/storage/emulated/0/Android/media/com.Slack/Notifications/Slack - Here you go.mp3' } cannot be found in the navigation graph NavGraph(0x0) startDestination={Destination(0x442b361f) route=home_screen}
As for the place, if I am passing a string like Here you go.mp3
, it's working fine!
I think Compose Navigation is not able to differentiate between /
The routes are parsed as Uris so if you want to send a string that contains special characters, you need to use
Uri.encode()
before appending them to your route.Navigation will automatically decode the arguments before delivering them to your destination, so you don't need to do anything to get the original Uri back out.