OpenFeature Provider for Android SDK
Integrate OpenFeature with Harness FME in your Android applications to evaluate feature flags, manage contexts, and track events using a standardized SDK.
Integrate your Android applications with Harness FME using the Android OpenFeature Provider, a standardized, vendor-agnostic feature flagging API. This provider implements the OpenFeature specification and bridges the OpenFeature SDK with the Harness FME Android SDK.
This page walks you through installing, configuring, and using the Android OpenFeature provider to evaluate feature flags in your Android applications.
Before you begin
Before you begin, ensure you have the following:
A valid Harness FME SDK key for your project
An Android project targeting API Level 21 (Android 5.0 Lollipop) or later
Access to your project's
build.gradleorbuild.gradle.ktsfile to add the provider dependency
Version compatibility
Android
API Level 21 (Android 5.0 Lollipop)
@splitsoftware/split-openfeature-provider-android
≥ 1.0.0
OpenFeature Kotlin SDK
≥ 0.7.0
Install the provider and dependencies
Add the Harness FME OpenFeature provider dependency to your application's build.gradle.kts file.
dependencies {
implementation("io.split.openfeature:split-openfeature-android:1.0.0")
}Or, if you're using the Groovy DSL (build.gradle):
Initialize the provider
The Harness FME OpenFeature provider requires an Android application Context (for SDK initialization) and your Harness FME SDK Key.
Construct an evaluation context
Provide an evaluation context with a targeting key to evaluate flags. The evaluation context passes targeting information such as user IDs, email addresses, or plan types for flag targeting.
For example:
To set a targeting key during initialization:
To change a targeting key at runtime:
Observe provider events
The Harness FME OpenFeature provider emits events when provider state changes (for example, when flags update, configuration changes, or errors) occur. You can observe these events to update your application's behavior in real time.
You can enable your application to:
Refresh feature-dependent UI when flags change
Gracefully handle degraded states (i.e., when the provider becomes stale)
Log or alert on configuration or network issues
Control initialization flows based on provider readiness
For example:
Track events
The Harness FME OpenFeature provider supports tracking user actions or conversion events directly from your Android application.
To enable event tracking, your evaluation context must include the following:
A non-empty
targetingKeyA
TrafficType(for example,"user"or"account")A non-blank event name
Optionally, you can include:
Optionally, you can include a numeric value (defaults to 0) and additional event properties (prefers primitives such as string, number, boolean, or null). For more information, see Sending Events.
For more information, go to the Harness FME Android OpenFeature Provider GitHub repository.
Last updated
Was this helpful?