Let's say I have the following buildType
section in my Gradle file:
buildTypes {
debug {
...
resValue "string", "DEEPLINK_EXAMPLE", "appnamedebug://detail/{detail_id}"
...
}
release {
...
resValue "string", "DEEPLINK_EXAMPLE", "appname://detail/{detail_id}"
...
}
}
I wanted to use the generated String resource as a deeplink in my Jetpack Navigation XML file as follows:
<deepLink app:uri="@string/DEEPLINK_EXAMPLE" />
I've tried something similar to this, but the Intent Filters don't show up when I looked at the output file from ./adb shell dumpsys package r
.
Is this even possible in the first place? If it is, is there something I missed?
That method in the question just leads to the manifest having the intent filter as follows:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="string" />
<data android:path="/DEEPLINK_EXAMPLE" />
</intent-filter>
I guess it's a pipe dream then.
Well, in the end I had to resort to the previous method: copying the Navigation Graphs to the debug and release source sets and set the deeplink URIs there accordingly.
So the Nav Graph in the debug
source set would have this:
<deepLink app:uri="appnamedebug://detail/{detail_id}" />
While the Nav Graph in the release
source set would have this:
<deepLink app:uri="appname://detail/{detail_id}" />
I'm actually not sure whether to keep the Nav Graph in the main
source code, or remove it so the ones in the debug
/release
source sets have precedence.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With