Android SDK for Kotlin
Add install tracking and purchase attribution to your Android app. Uses the Install Referrer API for deterministic attribution. Zero third-party dependencies.
Quick start
Track your first install in under 5 minutes.
import com.appfiliate.sdk.Appfiliate
// In Application.onCreate() or main Activity:
Appfiliate.configure(this, appId = "APP_ID", apiKey = "API_KEY")
Appfiliate.trackInstall(this)Get your App ID and API Key from your Appfiliate dashboard.
Integration guide
Step-by-step instructions to integrate the Appfiliate Android SDK.
Add the dependency
Add JitPack to your settings.gradle.kts:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}Then add to your app's build.gradle.kts:
dependencies {
implementation("com.github.Appfiliate-sdk:appfiliate-android-sdk:1.0.0")
}Configure and track installs
Find your Application class or main Activity. Add the following:
import com.appfiliate.sdk.Appfiliate
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
Appfiliate.configure(this, appId = "APP_ID", apiKey = "API_KEY")
Appfiliate.trackInstall(this)
}
}trackInstall() only fires once per install — it's safe to call on every launch.
Track purchases (optional)
After a successful Google Play Billing purchase, call trackPurchase():
Appfiliate.trackPurchase(
context = this,
productId = purchase.products.first(),
revenue = 9.99,
currency = "USD",
transactionId = purchase.orderId
)Set user ID for webhooks (optional)
If you use RevenueCat, Superwall, Adapty, Qonversion, or Stripe, link the user ID so purchases are attributed automatically:
// RevenueCat example
Appfiliate.setUserId(this, Purchases.sharedInstance.appUserID)
// Stripe example
Appfiliate.setUserId(this, stripeCustomerId)Automatic Purchase Tracking
RevenueCat webhook integration
Connect RevenueCat and every purchase, renewal, and cancellation is attributed automatically. No manual trackPurchase() calls needed.
1. Add one line of code
Appfiliate.configure(this, appId = "APP_ID", apiKey = "API_KEY")
Appfiliate.trackInstall(this)
Appfiliate.setUserId(this, Purchases.sharedInstance.appUserID)2. Paste the webhook URL
In your RevenueCat dashboard, go to Integrations → Webhooks and paste:
https://us-central1-appfiliate-5a18b.cloudfunctions.net/api/v1/webhooks/revenuecatAlso works with Superwall, Adapty, Qonversion, and Stripe.
Start tracking Android installs today
3 lines of code. Deterministic attribution via Install Referrer API. Free plan included.