Skip to main content

Gradle

1. Installation

The initial step doesn't involve code; it occurs directly on our platform:

If it is not already done, you need to create a source:

  1. Click on Sources in the left panel.
  2. Click on + card.
  3. Use In app survey.
  4. Use Android and enter a name for your source (it can be anything you want, it is just use to identify your source on our platform).
  5. Go to the installation page: https://{TOLD_URL}/source/{YOUR_SOURCE_ID}/installation
  6. Register your application ID
  7. Told Android SDK is published to Maven Central. Add dependency below: In libs.versions.toml:
[versions]

toldSdk = "2.1.0"

[libraries]

toldSdk = { group = "club.told", name = "told-android-sdk", version.ref = "toldSdk" }

In your build.gradle.kts file where you want to use Told:

dependencies {
implementation(libs.toldSdk)
}

Check existence or add mavenCentral() in your settings.gradle.kts root file:

dependencyResolutionManagement {
repositories {
mavenCentral()
}
}

2. Initialization

A common approach is to set up the Told SDK within your class that extends Application.

import android.app.Application
import com.told.sdk.ToldSDK
import com.told.sdk.ToldConfiguration
import com.told.sdk.ToldEnvironment

class MyApplication : Application() {

override fun onCreate() {
super.onCreate()
Told.init(
configuration = ToldConfiguration(
sourceId = "MySourceId",
applicationId = applicationContext.packageName,
appVersion = "${BuildConfig.VERSION_NAME}#${BuildConfig.VERSION_CODE}",
environment = ToldEnvironment.Production,
preview = false,
),
applicationContext = applicationContext,
)
}
}

Please ensure that:

  • Told.init is called only once during your app lifecycle.
  • You use the applicationContext and not a Context linked to an activity, fragment or a Composable.

3. Verification

Relaunch your application and if you have set everything up correctly, the status of your source should change to "Installed".

If the status remains unchanged, you can try the following steps:

  • Ensure that you are correctly calling the SDK's init function.
  • Verify that the source ID is accurate.
  • Refresh the installation page to update the status.
  • Check your Logcat for details. You can filter with tag:Told.

If none of these steps resolve the issue, please feel free to contact us directly via the "Contact us" button on our platform.