Installation
Add the SDK
Add JitPack to your project-level build.gradle or settings.gradle.kts:
repositories {
maven { url "https://jitpack.io" }
}Then add to your app’s build.gradle:
dependencies {
implementation 'com.github.AttributeHQ:android-sdk:1.0.0'
}Required Permissions
The SDK automatically includes these permissions via its manifest:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />The AD_ID permission is required for GAID (Google Advertising ID) collection. If you don’t need GAID, you can remove it with a manifest merger rule.
Initialize the SDK
In your Application class:
import android.app.Application
import com.attributehq.sdk.AttributeHQ
import com.attributehq.sdk.AttributeHQConfiguration
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
val config = AttributeHQConfiguration(
apiKey = "ak_your_api_key",
appId = "your-app-uuid"
)
AttributeHQ.initialize(this, config)
}
}Make sure your Application class is declared in AndroidManifest.xml:
<application
android:name=".MyApp"
...>Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | String | — | Required. API key from dashboard |
appId | String | — | Required. App UUID from dashboard |
enableDebugLogging | Boolean | false | Print debug logs to Logcat |
batchSize | Int | 10 | Events per batch before auto-flush |
flushInterval | Long | 5 | Seconds between auto-flush |
maxQueueSize | Int | 100 | Max events in offline queue |
ProGuard / R8 Rules
If you use code shrinking, add these ProGuard rules:
-keep class com.attributehq.sdk.** { *; }
-keepclassmembers class com.attributehq.sdk.** { *; }The SDK ships with consumer-rules.pro that should be applied automatically.
Dependencies
The SDK depends on:
| Dependency | Purpose |
|---|---|
com.google.android.gms:play-services-ads-identifier:18.0.1 | GAID collection |
com.android.installreferrer:installreferrer:2.2 | Google Play Install Referrer |
androidx.lifecycle:lifecycle-process:2.7.0 | App lifecycle detection |
androidx.core:core-ktx:1.12.0 | Kotlin extensions |
All dependencies are managed via Gradle — no manual setup required.