Skip to main content

Add the SDK Dependency

Add the following dependency to your app-level build.gradle file.
implementation("com.twinalyze:analytics:1.2.18")
In your project-level build.gradle, make sure the following plugins are configured:
plugins {
    id("com.android.application") version "8.13.2" apply false
    id("org.jetbrains.kotlin.android") version "2.0.21" apply false
    id("org.jetbrains.kotlin.plugin.compose") version "2.0.21" apply false
}

Initializing Analytics SDK in Android

Initialize the Twinalyze Analytics SDK inside your Application class. This allows the SDK to start tracking sessions, events, and app-level insights properly.
Twinalyze.initialize(
    this,
    "YOUR_API_KEY",
    "YOUR_SECRET_ID",
    object : TwinalyzeInitializationStatus {
        override fun onSuccess() {

        }

        override fun onFailed(twinalyzeError: TwinalyzeError) {

        }
    }
)

application

Android application context.

apiKey

Your Twinalyze project API key.

secretKey

Your Twinalyze project secret key.

Demo Account

Email: support@twinalyze.comPassword: demo@123

Github Demo

Open the Android demo project.

Download APK

Download and test the demo APK.

Demo

Open the Twinalyze demo dashboard.
✅ Best Practice
Always call initialize() inside your Application class, not inside an Activity. This helps Twinalyze capture complete session tracking from the start of the app lifecycle.
Twinalyze.initialize(
    this,
    "4204c9d6815644247690743d26fa7d1ae8b6c210c6",
    "c07168ab44102507311682f976863dd0cfaf62d7196c6d7d3d234353b8ec9d86",
    object : TwinalyzeInitializationStatus {
        override fun onSuccess() {

        }

        override fun onFailed(twinalyzeError: TwinalyzeError) {

        }
    }
)

Add ProGuard File

Add the following rules in your proguard-rules.pro file.
-keepnames class * extends android.app.Activity
-keepnames class * extends androidx.appcompat.app.AppCompatActivity
-keepnames class * extends androidx.fragment.app.FragmentActivity
-keepnames class * extends androidx.fragment.app.Fragment
-keep class com.twinalyze.** { *; }