I'm using jetpack navigation component with single activity structure and dynamic feature module approach to separate application modules. I don't want make modules on-demand for now, so all of them will install on installation base app module. In my app module navigation XML I have 4 include-dynamic parts that refers to each dynamic modules:
<?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"
android:id="@+id/app_navigation_graph"
app:startDestination="@id/featurePaydarNavGraph">
<include-dynamic
android:id="@+id/featurePaydarNavGraph"
app:graphResName="feature_paydar_nav_graph"
app:moduleName="feature_paydar" />
<include-dynamic
android:id="@+id/featurePawintoNavGraph"
app:graphResName="feature_pawinto_nav_graph"
app:moduleName="feature_pawinto" />
<include-dynamic
android:id="@+id/featureToolsNavGraph"
app:graphResName="feature_tools_nav_graph"
app:moduleName="feature_tools" />
<include-dynamic
android:id="@+id/featureServicesNavGraph"
app:graphResName="feature_services_nav_graph"
app:moduleName="feature_services" />
</navigation>
Some parts of modules have connections for example in tools module it has QR code ability that reads and will navigate to other fragment in other module, so I create a deeplink in second module to make navigation easier with Navigation-Component NavManager
.
The problem is if I didn't enter second module before calling deeplink from first module it makes application crashes that says couldn't find deeplink, but when I entered second module and then call deeplink from first module it will work fine without any problem. So I think that something should be triggered to make navigation understand dynamic module deeplinks.
I know google mentioned in the end of the following link (Limitations section) that deeplink not supported for dynamic-module yet:
Navigation-dynamic Limitations
So I figured out that it works when target module was open before calling it's deeplink from other module and won't work when not opened before.