If I am using sage-args an directions and they do not have possibility to pass arguments and then I do
navController.navigate(R.id.action_to_authenticationFlow, bundle)
I am not getting this arguments in Fragment
val uriString = arguments?.getString("uri")
Is it ok and I need to config safe args or something is done wrong with bundle passing?
UPDATE
I've changed to suggested solution but I think there is problem that I have nested login.xml graph and trying to pass this arguments to fragment in this nested graph.
login.xml
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/loginFlow"
app:startDestination="@id/authenticationFragment">
<fragment
android:id="@+id/authenticationFragment"
android:name="com.softne.crm.ui.authentication.AuthenticationFragment"
android:label="fragment_authentication"
tools:layout="@layout/fragment_authentication">
<argument
android:name="uri"
app:argType="string"
app:nullable="true" />
</fragment>
</navigation>
and here main.xml
<action android:id="@+id/action_to_authenticationFlow"
app:destination="@id/loginFlow" >
<argument
android:name="uri"
app:argType="string"
app:nullable="true" />
</action>
I've modified to this code but also does not work
val args: AuthenticationFragmentArgs by navArgs()
private fun handleDeepLinks() {
val uriString = arguments?.getString("uri")
Toast.makeText(context, uriString, Toast.LENGTH_LONG).show()
And I am using Driections class from action_to_authenticationFlow
val navController = findNavController(R.id.navHostFragment)
val action = DashboardFragmentDirections.actionToAuthenticationFlow(uriString)
navController.navigate(action)