Use Cursor, Claude Code, or another AI to help you integrate the Android (Kotlin) SDK.
Repository
Here, you will find the Maven Central Android SDK documentation. Please, use the latest version of the SDK available.Quickstart
Use this path when you only need the minimum production integration:- Add the SDK dependency from Maven Central.
- Copy the Production API key from SDK in Appstack.
- Call
AppstackAttributionSdk.configure(...)fromApplication.onCreate(). - Send standard events such as
EventType.LOGIN,EventType.SIGN_UP,EventType.PURCHASE, andEventType.SUBSCRIBE. - Confirm events appear in the Appstack SDK page before enabling downstream integrations.
Requirements
- Minimum SDK: Android 5.0 (API level 21).
- Target SDK: 35+
- Java Version: 17+
- Gradle: 8.0+ (the SDK is built with Gradle 8.13 and Android Gradle Plugin 8.12)
Initial setup
1
Installation
Add the SDK dependency to your app’s No additional Gradle configuration is needed after adding the dependency. You still need to initialize the SDK in
build.gradle.kts:Application.onCreate() before sending events.2
Initialization
Follow these steps to get the API key:
- In Appstack, from the side menu, select SDK and ensure you are selecting the correct application.
- Select the Production environment.
- Copy the API key.
Application class:3
Configuration parameters
Initialize the SDK with your API key. Must be called in
Application.onCreate() before any other SDK methods.context(Context, required): Application context.apiKey(String, required): Your Appstack API key.logLevel(LogLevel, default:LogLevel.INFO): Console log verbosity. One ofDEBUG,INFO,WARN,ERROR,NONE.listener(InitListener?, default: null): Optional callback invoked on initialization success or error.customerUserId(String?, default: null): Your own user identifier, attached to the event payload.
logLevel only controls logcat output (tag AppstackSdk); it does not change what the SDK sends.4
Sending events
Track user actions and revenue in your activities:Available EventType valuesIt is recommended to use standard events for a smoother experience.To improve matching quality on Meta, send events including the following parameters if you can fulfill them. Appstack automatically encrypts these matching parameters before using them for attribution matching.
EventType.INSTALL is tracked automatically on SDK initialization. Do not send it manually.EventType.LOGINUser login.EventType.SIGN_UP/EventType.REGISTERUser registration.EventType.PURCHASEPurchase transactions.EventType.SUBSCRIBESubscription events.EventType.ADD_TO_CART,EventType.ADD_TO_WISHLIST,EventType.INITIATE_CHECKOUTE-commerce events.EventType.START_TRIALTrial start.EventType.LEVEL_START/EventType.LEVEL_COMPLETEGame progression.EventType.TUTORIAL_COMPLETE,EventType.SEARCH,EventType.VIEW_ITEM,EventType.VIEW_CONTENT,EventType.SHAREEngagement events.EventType.CUSTOMFor any other custom events.
eventEvent type from EventType enum (required).nameEvent name for custom events (optional, required when event is CUSTOM).parameters- Optional map of parameters (e.g.,mapOf("revenue" to 29.99, "currency" to "USD")).
revenueorprice(number).currency(string, e.g.EUR,USD).
email.name(first + last name in the same field).phone_number— also accepted asphoneorphoneNumber.date_of_birth(recommended format:YYYY-MM-DD) — also accepted asbirthdate,birthday, ordateOfBirth.gender.
Appstack ID and attribution params
Afterconfigure, you can read the Appstack user ID and the attribution map for partner integrations (for example Superwall, RevenueCat).
getAppstackId()— Appstack user identifier when a partner expects$appstackIdor similar.awaitAttributionParams()—suspendfunction that waits for the initial attribution match, then returns the attribution payload (campaign, media source, click IDs, device identifiers where available) to forward to partners. Prefer this over a fixed delay after launch.getAttributionParams()— Non-suspending variant that returns whatever is cached right now. Called immediately afterconfigure(...)it can still be empty, because the match runs asynchronously.
Development setup
If you want to test the SDK against the Appstack development environment before shipping, follow these extra steps:- In Appstack, from the side menu, select SDK, switch to the Development environment, and copy the Development API key. This key is separate from your production key.
- In your
configure(...)call, use the development key and raise the log level:
LogLevel.DEBUG prints the SDK’s initialization, attribution, and event traffic to logcat under the tag AppstackSdk:
Security and privacy
- Never commit API keys to version control.
- Use separate production and development keys, and make sure release builds ship the production key.
- Keep
LogLevel.DEBUGbehind aBuildConfig.DEBUGguard so release builds stay quiet. - Do not put personally identifiable information in event names.
- Only send matching parameters such as
email,name,phone_number, anddate_of_birthwhen your app has the right consent and compliance basis. Appstack automatically encrypts these fields before using them for attribution matching. - Prefer standard event types for common flows so event mapping remains consistent across Appstack and ad integrations.
Limitations
Platform constraints
- Android 5.0+ required (API level 21).
- Attribution only works for Play Store installations.
- Network connectivity is required at the moment an event is sent. There is no durable offline queue: an event tracked while the device is offline is dropped, not stored for later. Transient failures on a request that did go out (network errors, HTTP 429/500/502/503/504) are retried in-flight with exponential backoff.
Event tracking
- The SDK must be initialized in
Application.onCreate()before tracking calls. - Custom event names should be descriptive and consistent.
- Events sent before the SDK is ready are buffered in memory and replayed once initialization completes.
INSTALLis tracked automatically on SDK initialization. Do not send it manually — the SDK drops such calls.- Revenue events should include
revenueorpriceandcurrency.
Troubleshooting
Configuration fails
- Confirm the API key was copied from the correct app and environment in Appstack.
- Confirm the SDK dependency resolves from Maven Central.
- Confirm your
Applicationclass is registered inAndroidManifest.xml. - Confirm your app declares the
INTERNETpermission inAndroidManifest.xml— without itconfigure(...)reports an error throughInitListener.onError()andgetLastInitError().
Events do not appear
- Confirm
configure(...)runs inApplication.onCreate()before the firstsendEvent(...)call. - Confirm the device has network connectivity.
- Confirm the app was installed from the Play Store when testing attribution.
- Check that revenue events include a numeric
revenueorpricevalue and a validcurrency. - Allow a few minutes for events to appear in the dashboard.
No SDK logs appear
- Confirm
configure(...)passeslogLevel = LogLevel.DEBUG. - Filter logcat on the SDK tag:
adb logcat -s AppstackSdk.
Superwall
To start using the Superwall integration, click here to see the correct SDK documentation.Verification checklist
- Dependency installed with
tech.appstack.android-sdk:appstack-android-sdk. - App meets min SDK 21, target SDK 35+, Java 17+, and Gradle 8.0+ requirements.
- Maven Central is available to Gradle.
- Production API key is used in release builds.
- Development API key is used only in development builds.
Applicationclass is registered inAndroidManifest.xml.configure(...)runs once fromApplication.onCreate().INSTALLis not sent manually.- Login, signup, purchase, subscription, and other key app events use standard event types where possible.
- Revenue events include
revenueorpriceandcurrency. - Custom events use
EventType.CUSTOMwith a descriptivename. - Appstack ID and attribution params are available before wiring partner integrations.
- Events are visible in the Appstack SDK page before launch.
Support
For questions or issues:- Check the GitHub Repository.
- Contact our support team at support@appstack.tech
- Open an issue in the repository.
Use Cursor, Claude Code, or another AI to validate your existing Appstack Android SDK (Kotlin) integration.