> ## Documentation Index
> Fetch the complete documentation index at: https://confidence.spotify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Android (Kotlin)

> Confidence Android SDK for feature flag evaluation in Kotlin and Java applications.

The Confidence Android SDK provides feature flag evaluation for Android applications. Flags resolve once according to the evaluation context, and values read from a local cache for fast access.

## Features

* **Local caching**: Flag values cached locally for instant access
* **OpenFeature compatible**: Standard feature flag API through OpenFeature provider
* **Automatic apply events**: Tracks flag usage
* **Managed context**: Automatic visitor ID and app lifecycle context
* **Offline support**: Cached values available without network

## Installation

<Tabs>
  <Tab title="Gradle (Kotlin DSL)">
    ```kotlin theme={null}
    dependencies {
        implementation("com.spotify.confidence:openfeature-provider-android:<latest>")
    }
    ```
  </Tab>

  <Tab title="Gradle (Groovy)">
    ```groovy theme={null}
    dependencies {
        implementation 'com.spotify.confidence:openfeature-provider-android:<latest>'
    }
    ```
  </Tab>
</Tabs>

## Quickstart

```kotlin theme={null}
import com.spotify.confidence.ConfidenceFactory
import com.spotify.confidence.ConfidenceFeatureProvider
import com.spotify.confidence.ConfidenceRegion
import com.spotify.confidence.InitialisationStrategy
import dev.openfeature.sdk.OpenFeatureAPI

// Create the Confidence provider
val provider = ConfidenceFeatureProvider.create(
    ConfidenceFactory.create(
        context = applicationContext,
        clientSecret = "your-client-secret",
        region = ConfidenceRegion.EUROPE
    ),
    initialisationStrategy = InitialisationStrategy.FetchAndActivate
)

// Register with OpenFeature
OpenFeatureAPI.setProviderAndWait(provider)
val client = OpenFeatureAPI.getClient()

// Evaluate a flag
val message = client.getStringValue("flag-name.message", "default message")
println("Flag value: $message")
```

## Resources

<CardGroup cols={2}>
  <Card title="GitHub repository" icon="github" href="https://github.com/spotify/confidence-sdk-android">
    Source code, examples, and full documentation
  </Card>

  <Card title="OpenFeature Android SDK" icon="flag" href="https://openfeature.dev/docs/reference/technologies/client/android">
    OpenFeature documentation
  </Card>

  <Card title="Context" icon="sliders" href="/docs/sdks/context">
    Configure evaluation context
  </Card>

  <Card title="Apply events" icon="chart-line" href="/docs/sdks/apply-event">
    Understand flag assignment tracking
  </Card>
</CardGroup>
