diff --git a/docs/sdk/client-side/android/index.md b/docs/sdk/client-side/android/index.md index 184f461..2369560 100644 --- a/docs/sdk/client-side/android/index.md +++ b/docs/sdk/client-side/android/index.md @@ -305,7 +305,86 @@ fun intVariation(featureId: String, defaultValue: Int): Int fun doubleVariation(featureId: String, defaultValue: Double): Double -fun jsonVariation(featureId: String, defaultValue: JSONObject): JSONObject +fun objectVariation(featureId: String, defaultValue: BKTValue): BKTValue +``` + + + + +### Getting evaluation details + +The following methods will return the **evaluation details** for a specific feature flag or will return **null** if the feature flag is missing in the SDK's cache. + +This is useful if you use another A/B Test solution with Bucketeer and need to know the variation name, reason, and other information. + + +#### Interface + + + + +```kotlin showLineNumbers +fun boolVariationDetails( + featureId: String, + defaultValue: Boolean, +): BKTEvaluationDetails + +fun stringVariationDetails( + featureId: String, + defaultValue: String, +): BKTEvaluationDetails + +fun intVariationDetails( + featureId: String, + defaultValue: Int, +): BKTEvaluationDetails + +fun doubleVariationDetails( + featureId: String, + defaultValue: Double, +): BKTEvaluationDetails + +fun objectVariationDetails( + featureId: String, + defaultValue: BKTValue, +): BKTEvaluationDetails +``` + + + + +#### Object + + + + +```kotlin showLineNumbers +data class BKTEvaluationDetails( + val featureId: String, + val featureVersion: Int, + val userId: String, + val variationId: String, + val variationName: String, + val variationValue: T, + val reason: Reason, +) +``` + + + + +#### Usage + + + + +```kotlin showLineNumbers +val showNewFeature = client.boolVariationDetails("YOUR_FEATURE_FLAG_ID", false) +if (showNewFeature.variationValue) { + // The Application code to show the new feature +} else { + // The code to run when the feature is off +} ``` @@ -527,50 +606,6 @@ val user = client.currentUser() -### Getting evaluation details - -This method will return the **evaluation details** for a specific feature flag or will return **null** if the feature flag is missing in the SDK's cache. - -This is useful if you use another A/B Test solution with Bucketeer and need to know the variation name, reason, and other information. - -
- Evaluation details - - - - ```kotlin showLineNumbers - data class BKTEvaluation( - var id: String, - val featureId: String, - val featureVersion: Int, - val userId: String, - val variationId: String, - val variationName: String, - val variationValue: String, - val reason: Reason, - ) - ``` - - - -
- -:::caution - -Do not call this method without calling the [Evaluating user method](#evaluating-user). The Evaluating user method must always be called because it generates analytics events that will be sent to the server. - -::: - - - - -```kotlin showLineNumbers -val evaluationDetails = client.evaluationDetails("YOUR_FEATURE_FLAG_ID") -``` - - - - ### Listening to evaluation updates