Skip to Content

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

OptionTypeDefaultDescription
apiKeyStringRequired. API key from dashboard
appIdStringRequired. App UUID from dashboard
enableDebugLoggingBooleanfalsePrint debug logs to Logcat
batchSizeInt10Events per batch before auto-flush
flushIntervalLong5Seconds between auto-flush
maxQueueSizeInt100Max 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:

DependencyPurpose
com.google.android.gms:play-services-ads-identifier:18.0.1GAID collection
com.android.installreferrer:installreferrer:2.2Google Play Install Referrer
androidx.lifecycle:lifecycle-process:2.7.0App lifecycle detection
androidx.core:core-ktx:1.12.0Kotlin extensions

All dependencies are managed via Gradle — no manual setup required.