4

I have base url defined in my gradle file like

buildTypes {
    debug {
        applicationIdSuffix ".debug"
        minifyEnabled false
        debuggable true
        buildConfigField("String", "BASE_URL", "\"https://abc.tech/api/\"")
    }
    stag {
        applicationIdSuffix ".stag"
        minifyEnabled false
        debuggable false
        buildConfigField("String", "BASE_URL", "\"https://xyz.tech/api/\"")
    }
}

I want BASE_URL to be accessed in my navigation graph where I have define deeplink. i.e

<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/navGraph"
    app:startDestination="@id/fragmentX">

     <fragment
        android:id="@+id/fragment1"
        android:name="com.xyz.abc.Fragmen1"
        android:label="Fragmen1">
        <argument
            android:name="userId"
            app:argType="string" />
        <argument
            android:name="code"
            app:argType="string" />

        <deepLink app:uri= "xyz.tech/api/confirm?userId={userId}&amp;code={code}" />

    </fragment>
</navigation>
Daniyal Javaid
  • 1,426
  • 2
  • 18
  • 32
  • 1
    It's impossible. The Android Navigation component does not support that feature to parse the string so far – hientp Jul 14 '21 at 05:42

1 Answers1

0

Placeholders from your Gradle file are not supported in any XML file at this time, but as per this comment:

[this feature] is currently scheduled for 7.1

You'd want to star that issue for updates as that functionality becomes available.

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443