Overview
This guide covers using Mixpanel’s Feature Flags through the OpenFeature standard with the Mixpanel Android OpenFeature provider. OpenFeature provides a vendor-agnostic API for feature flag evaluation, allowing you to switch between providers without changing your application code. For the native Mixpanel SDK approach, see the Feature Flags (Android) guide.Prerequisites
- Enterprise subscription plan with Feature Flags enabled
- Android SDK 21+
- Project Token from your Mixpanel Project Settings
Installation
Add to yourbuild.gradle.kts:
Quick Start
Using an Existing MixpanelAPI Instance
Usage
Flag Types and Evaluation Methods
Evaluation Context
Context must be set globally viaOpenFeatureAPI.setContext():
Runtime Properties
Passcustom_properties in the evaluation context for runtime targeting:
Unlike some providers,
targetingKey is not used as a special bucketing key. It is passed as another context property. Mixpanel’s server-side configuration determines which properties are used for targeting and bucketing.Full Resolution Details
User Identity
This provider does not callmixpanel.identify(). Manage identity through the same Mixpanel instance:
Error Handling
Troubleshooting
Flags Always Return Default Values
- Feature flags not enabled: Ensure MixpanelOptions includes
.featureFlags(). - Provider not ready: Use
setProviderAndWaitto ensure initialization. - Network issues: Check Logcat for failed requests.
- Flag not configured: Verify the flag exists and is enabled.