Install

Install on Android

Add the Sankofa Android SDK to your app via Maven Central, with auto-registered lifecycle tracking and offline-first event queueing.

The Sankofa Android SDK is a single Kotlin-first library, distributed through Maven Central as dev.sankofa.sdk:sankofa-android. It bundles six products (Analytics, Catch, Switch, Config, Pulse, Replay), auto-registers across all Activities, and uses WorkManager for reliable background flushing. OTA Deploy is not exposed on Android — for hybrid apps that need OTA, use the React Native SDK.

Requirements

  • Android Studio Hedgehog or newer
  • minSdk 24 (Android 7.0)
  • compileSdk 34+ recommended
  • Kotlin 1.9+ (Java 8 is also supported)

1. Add the dependency

Kotlinapp/build.gradle.kts
dependencies {
  implementation("dev.sankofa.sdk:sankofa-android:1.0.0")
}

Make sure mavenCentral() is in your repositories list (the default for new Android Studio projects).

2. Bump minSdk and enable Java 8

The SDK targets minSdk 24 and uses Java 8 features. Update your module's Gradle config if needed:

Kotlinapp/build.gradle.kts
android {
  namespace = "com.example.app"
  compileSdk = 35

  defaultConfig {
      minSdk = 24
      targetSdk = 35
  }

  compileOptions {
      sourceCompatibility = JavaVersion.VERSION_1_8
      targetCompatibility = JavaVersion.VERSION_1_8
  }

  kotlinOptions {
      jvmTarget = "1.8"
  }
}

3. Initialize in Application.onCreate

The SDK must initialize before the first Activity, so place the call in your Application subclass.

KotlinMyApplication.kt
import android.app.Application
import dev.sankofa.sdk.Sankofa
import dev.sankofa.sdk.SankofaConfig

class MyApplication : Application() {
  override fun onCreate() {
      super.onCreate()
      Sankofa.init(
          context = this,
          apiKey = BuildConfig.SANKOFA_KEY,
          config = SankofaConfig(
              endpoint = "https://api.sankofa.dev",
              recordSessions = true,
              maskAllInputs = true,
              debug = BuildConfig.DEBUG,
          ),
      )
  }
}

Register the application class in your manifest:

xmlAndroidManifest.xml
<application
  android:name=".MyApplication"
  android:label="@string/app_name">
  ...
</application>

Pass the API key through BuildConfig (recommended) or via local.properties so it never lands in version control.

Common config options

endpointStringdefault https://api.sankofa.dev
Server base URL.
recordSessionsBooleandefault true
Enable high-fidelity session replay.
maskAllInputsBooleandefault true
Auto-mask all EditText views in replays.
debugBooleandefault false
Verbose Logcat output during development.
trackLifecycleEventsBooleandefault true
Auto-track $app_opened, foregrounded, backgrounded.
flushIntervalSecondsIntdefault 30
Foreground flush cadence.
batchSizeIntdefault 50
Maximum events per batch upload.

4. Verify the install

Kotlin
Sankofa.track("install_check", mapOf("from" to "android-quickstart"))

Run the app, then open app.sankofa.devLive events. The event should appear with an android source label.

What's next

Edit this page on GitHub