Skip to main content
Version: v1.20.1

Android / Kotlin

Static Badge

This OpenFeature provider is a Kotlin implementation for Android to communicate with the GO Feature Flag Server.

The OpenFeature Kotlin is experimental, and the provider is also experimental.
We don't recommend using this in production yet.

About this provider

GO Feature Flag provider allows you to connect to your GO Feature Flag instance with the OpenFeature Kotlin SDK.

This is a client provider made for Android, we do not recommend using it in a server environment.
If you want to use it in a server environment, you should use the Java provider.

Install the provider

implementation("org.gofeatureflag.openfeature:gofeatureflag-kotlin-provider:0.0.1-beta.1")

How to use the provider?

val evaluationContext = ImmutableContext(
targetingKey = "0a23d9a5-0a8f-42c9-9f5f-4de3afd6cf99",
attributes = mutableMapOf(
"region" to Value.String("us-east-1"),
"email" to Value.String("john.doe@gofeatureflag.org")
)
)

OpenFeatureAPI.setProvider(
GoFeatureFlagProvider(
options = GoFeatureFlagOptions(
endpoint = "http://localhost:1031"
)
), evaluationContext
)

val client = OpenFeatureAPI.getClient("my-client")
if (client.getBooleanValue("my-flag", false)) {
println("my-flag is enabled")
}
OpenFeatureAPI.shutdown()

Available options

Option nameTypeDefaultDescription
endpointStringendpoint is the URL where your GO Feature Flag server is located.
timeoutLong10000(optional) timeout is the time in millisecond we wait for an answer from the server.
maxIdleConnectionsInt1000(optional) maxIdleConnections is the maximum number of connexions in the connexion pool.
keepAliveDurationLong7200000(optional) keepAliveDuration is the time in millisecond we keep the connexion open.
apiKeyString(optional) If GO Feature Flag is configured to authenticate the requests, you should provide an API Key to the provider. Please ask the administrator of the relay proxy to provide an API Key.
retryDelayLong300(optional) delay in millisecond to wait before retrying to connect the websocket

Reconnection

If the connection to the GO Feature Flag instance fails, the provider will attempt to reconnect.

Event streaming

Event streaming is not implemented yet in the GO Feature Flag provider.

Features status

StatusFeatureDescription
Flag evaluationIt is possible to evaluate all the type of flags
Cache invalidationWebsocket mechanism is in place to refresh the cache in case of configuration change
LoggingNot supported by the SDK
Flag MetadataNot supported by the SDK
Event StreamingNot implemented
Unit testNot implemented
Implemented: ✅ | In-progress: ⚠️ | Not implemented yet: ❌

Get the latest GO Feature Flag updates