Quickstart: Android
Add FounderHQ to a Kotlin or Compose app.
Add the dependency, create the client once, and see your first event in FounderHQ. About 5 minutes.
Before you start
You need a FounderHQ account, Android Studio, and a publishable key. In the app, open Sequences → Settings → Event API keys, create a key for Browser/mobile, and copy it. The full key is shown only once.
Add the dependency
In your app module's build.gradle.kts:
dependencies {
implementation("com.getfounderhq:events:0.8.0")
}Using Navigation Compose? Add the companion artifact too.
implementation("com.getfounderhq:events-compose:0.8.0")Create the client in your Application class
import android.app.Application
import com.founderhq.events.FounderHQEvents
class MyApplication : Application() {
lateinit var events: FounderHQEvents
override fun onCreate() {
super.onCreate()
events = FounderHQEvents(this, "fhq_pk_XXXX")
}
}Register the class in AndroidManifest.xml with
android:name=".MyApplication" if you have not already.
App and activity lifecycle, activity screens, sessions, and on-device queuing start immediately. The queue survives a restart, so events captured offline still arrive.
To change the defaults, pass a config:
FounderHQEvents(this, "fhq_pk_XXXX", FounderHQEventsConfig(captureScreens = false)).
Track Compose screens
Activity screens are captured for you. Compose destinations are not.
import com.founderhq.events.compose.FounderHQNavigationObserver
FounderHQNavigationObserver(navController = navController, events = events)Place it inside the composable that owns your NavHost.
Identify and capture
events.identify("user_8421", mapOf("email" to "jane@acme.com"))
events.capture("trial.started", mapOf("plan" to "pro"))Pass your own stable user ID, not an email. Call events.reset() on
sign-out.
Reading Play Install Referrer data? Hand it over, so the campaign that
drove the install is kept: events.captureInstallReferrer(properties).
For universal links, call events.captureDeepLink(url).
Verify
- Run the app on an emulator or device and trigger the event.
- In FounderHQ, open Sequences → Events.
- You see
trial.startedwithplan: pro, a$session_start, and a$screenfor the screen you opened. - Open Sequences → Contacts. Jane is there with her email.
Events can take a few seconds to appear. The SDK batches them. To send
immediately, call events.flush() off the main thread.
Troubleshoot
No $screen events from Compose
Only activity screens are automatic. Add FounderHQNavigationObserver
next to your NavHost.
Purchases are not attributed
In-app purchases need the purchase claim flow, not capture. See
Mobile purchase claims.