Tuesday 10 September 2019

Navigation components : Deeplink using uri depending buildType

Any way to read a constant depending buildType ${deepLinkHost}?

debug -> deepLinkUri = http://link.debug/
staging -> deepLinkUri = http://link.staging/
release ->  deepLinkUri=  http://link/

<?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/navigation_home"
    app:startDestination="@id/fragment_home">

    <fragment
        android:id="@+id/fragment_home"
        android:name="..."
        tools:layout="@layout/fragment_home">
        <argument
            android:name="token"
            android:defaultValue="@null"
            app:argType="string"
            app:nullable="true" />
        <deepLink app:uri="${deepLinkUri}/?code={token}" />
</fragment>

This was manage before with manifestPlaceholders.deepLinkHost on build.gradle and deeplinks by activity in the AndroidManifest, but once google uses 1 Activity to N Fragments, how can we manage it with navigation components?



from Navigation components : Deeplink using uri depending buildType

No comments:

Post a Comment