# Quickstart: Android (https://www.getfounderhq.com/docs/analytics/getting-started/quickstart-android)

Add the dependency, create the client once, and see your first event in
FounderHQ. About 5 minutes.

<Callout title="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.
</Callout>

## 1. Add the dependency

In your app module's `build.gradle.kts`:

```kotlin
dependencies {
    implementation("com.getfounderhq:events:0.8.0")
}
```

Using Navigation Compose? Add the companion artifact too.

```kotlin
implementation("com.getfounderhq:events-compose:0.8.0")
```

## 2. Create the client in your Application class

```kotlin
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))`.

## 3. Track Compose screens

Activity screens are captured for you. Compose destinations are not.

```kotlin
import com.founderhq.events.compose.FounderHQNavigationObserver

FounderHQNavigationObserver(navController = navController, events = events)
```

Place it inside the composable that owns your `NavHost`.

## 4. Identify and capture

```kotlin
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

1. Run the app on an emulator or device and trigger the event.
2. In FounderHQ, open **Sequences → Events**.
3. You see `trial.started` with `plan: pro`, a `$session_start`, and a
   `$screen` for the screen you opened.
4. 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](/analytics/revenue/mobile-purchase-claims).

## Next

- [Android SDK reference](/analytics/sdks/android)
- [Identity and contacts](/analytics/concepts/identity-and-contacts)
