Skip to main content

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.

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

dependencies {
    implementation("com.spotify.confidence:openfeature-provider-android:0.6.2")
}

Quickstart

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

GitHub repository

Source code, examples, and full documentation

OpenFeature Android SDK

OpenFeature documentation

Context

Configure evaluation context

Apply events

Understand flag assignment tracking