For the complete documentation index, see llms.txt. This page is also available as Markdown.

Feature Flag Decision

This feature is supported in Android SDK 2.0.0 and above.

A Feature Flag has two states: on and off. Different features are configured for each state. When a user accesses a feature with a Feature Flag applied, the SDK must return the on or off state. You can use the Hackle SDK to make this decision.

isFeatureOn

Pass the Feature Key to the isFeatureOn() method to receive the state result for the user. Then implement logic based on the state.

The example code below passes Feature Key 42.

import io.hackle.android.HackleApp

// 기능 키가 42인 기능 플래그에서 사용자의 상태를 결정합니다.
// 결정하지 못하는 상황인 경우 false(꺼짐 상태)를 반환합니다.
val isFeatureOn: Boolean = hackleApp.isFeatureOn(42, "ae03e1adf")

if (isFeatureOn) {
    // ON 기능
} else {
    // OFF 기능
}

featureFlagDetail

The featureFlagDetail() method works the same as isFeatureOn() but also provides the reason for the state decision. This is useful for checking whether an Override is working correctly, or when the distribution result seems inconsistent with the configured Traffic Allocation.

You must pass the Feature Key as a parameter. The example code below passes Feature Key 42.

The state decision reason is returned in the format SDK_NOT_READY. See the table below for details.

Decision Reason
Description
Distribution Result

SDK_NOT_READY

The SDK is not ready to use. (e.g., initialization attempted with an invalid SDK Key)

Default state (off)

FEATURE_FLAG_NOT_FOUND

No Feature Flag was found for the provided Feature Key. The Feature Key may be incorrect, or the Feature Flag may be archived.

Default state (off)

FEATURE_FLAG_INACTIVE

The Feature Flag is in the off state.

Default state (off)

INDIVIDUAL_TARGET_MATCH

Matched by Individual Targeting.

State configured by Individual Targeting

TARGET_RULE_MATCH

Matched by User Targeting.

State configured by User Targeting

DEFAULT_RULE

Did not match either Individual Targeting or User Targeting.

State configured by default rule

EXCEPTION

An unknown error occurred.

Default state (off)

Feature Flag Parameters

This feature is supported in Android SDK 2.9.0 and above.

  • The featureFlagDetail() method also returns the parameter values for the state decision.

  • The FeatureFlagDecision instance returned by featureFlagDetail() contains a ParameterConfig object with all parameter configuration.

  • Since parameters set on the Hackle Feature Flag screen exist as key-value pairs, you can use the methods below to retrieve parameter values according to the configured parameter type.

  • You can dynamically change values on the Feature Flag parameter settings screen.

getString

  • Returns a parameter value configured as STRING or JSON type.

  • Returns the value configured for False or True based on the state decision.

getInt

  • Returns a parameter value configured as Number type as an Int.

  • Returns the value configured for False or True based on the state decision.

getDouble

  • Returns a parameter value configured as Number type as a Double.

  • Returns the value configured for False or True based on the state decision.

getLong

  • Returns a parameter value configured as Number type as a Long.

  • Returns the value configured for False or True based on the state decision.

getBoolean

  • Returns a parameter value configured as Boolean type.

  • Returns the value configured for False or True based on the state decision.

Last updated