Package com.mixpanel.android.mpmetrics
Class FeatureFlagOptions
java.lang.Object
com.mixpanel.android.mpmetrics.FeatureFlagOptions
Configuration options for Mixpanel feature flags.
Use this class to consolidate all feature flag settings into a single
configuration object when initializing a MixpanelAPI instance via
MixpanelOptions.Builder.featureFlagOptions(FeatureFlagOptions).
FeatureFlagOptions featureFlagOptions = new FeatureFlagOptions.Builder()
.enabled(true)
.context(new JSONObject().put("plan", "enterprise"))
.prefetchFlags(true)
.build();
MixpanelOptions options = new MixpanelOptions.Builder()
.featureFlagOptions(featureFlagOptions)
.build();
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionorg.json.JSONObjectReturns a defensive copy of the context used for evaluating feature flags.booleanReturns whether feature flags are enabled.booleanReturns whether feature flags should be automatically loaded on the first app foreground event.
-
Method Details
-
isEnabled
public boolean isEnabled()Returns whether feature flags are enabled.- Returns:
trueif feature flags are enabled,falseotherwise. Defaults tofalse.
-
getContext
@NonNull public org.json.JSONObject getContext()Returns a defensive copy of the context used for evaluating feature flags.The returned
JSONObjectis a copy; mutating it will not affect thisFeatureFlagOptionsinstance.- Returns:
- A non-null JSONObject containing the feature flags context. Defaults to an empty JSONObject.
-
shouldPrefetchFlags
public boolean shouldPrefetchFlags()Returns whether feature flags should be automatically loaded on the first app foreground event.- Returns:
trueif flags should be prefetched on first foreground,falseotherwise. Defaults totrue.
-