# errorgap for Android (Kotlin)

See [index.md](./index.md) for API details and the placeholder values (`ERRORGAP_API_KEY`, `ERRORGAP_ENDPOINT`, `ERRORGAP_PROJECT_SLUG`).

SDK source: `github.com/errorgaphq/errorgap-android` · current version: `0.2.0`. Requires JDK 17 to build, Android API 24+ at runtime.

## Install

```kotlin
dependencies {
    implementation("com.errorgap:errorgap-android:0.2.0")
}
```

## Configure

In `Application.onCreate()`:

```kotlin
import android.app.Application
import android.os.Build
import com.errorgap.android.Errorgap
import com.errorgap.android.ErrorgapConfiguration

class App : Application() {
    override fun onCreate() {
        super.onCreate()
        Errorgap.init(ErrorgapConfiguration(
            endpoint = BuildConfig.ERRORGAP_ENDPOINT,
            projectSlug = BuildConfig.ERRORGAP_PROJECT_SLUG,
            apiKey = BuildConfig.ERRORGAP_API_KEY,
            environment = if (BuildConfig.DEBUG) "development" else "production",
            release = BuildConfig.VERSION_NAME,
            deviceInfo = mapOf(
                "os_name" to "Android",
                "os_version" to Build.VERSION.RELEASE,
                "device_model" to Build.MODEL,
                "manufacturer" to Build.MANUFACTURER,
                "app_version" to BuildConfig.VERSION_NAME,
                "app_build" to BuildConfig.VERSION_CODE.toString(),
            ),
        ))
    }
}
```

The SDK installs a `Thread.setDefaultUncaughtExceptionHandler` automatically. `deviceInfo` is caller-supplied so the SDK ships no platform-specific deps; the snippet above shows the canonical wiring.

## Trigger a test error

```kotlin
button.setOnClickListener {
    throw RuntimeException("Errorgap test error")
}
```

## Verify

Run the verification curl from [index.md](./index.md), then tap the button and confirm the onboarding screen advances.
