Mobile Android Feature Flags

Feature flag / toggle management built for Android mobile apps

Feature flags are a software development best practice of gating functionality. Functionality can be deployed “off”, then turned on via the feature flag, separate from deployment. With feature flags, you can manage the entire lifecycle of a feature.

LaunchDarkly's Mobile Android SDK lets you create and maintain feature flags across your entire mobile application. You can centrally manage all of your feature flags, perform granular rollouts, and kill bad features without redeploying. All flag values are evaluated in-memory, so there is no latency for your users. New flag settings are streamed to the SDKs in real-time, so any changes to your flag rules will take effect almost immediately.

With LaunchDarkly, you can toggle your features from our dashboard - that means you can roll out and roll back features without having to release a new version to the Android store.

LaunchDarkly Dashboard & Feature Flag Manager
Click Image to Enlarge

Here are some product benefits of LaunchDarkly's Mobile Android Feature Flag SDK:

  • Avoid "zero star" reviews by turning off broken features.
  • Optimize user flows and measure performance.
  • Real-time rollbacks to minimize downtime.
  • Real-time feature flags via a streaming API
  • In-memory flag evaluation with near zero latency
  • No external HTTP calls for flag values
  • Boolean & multivariate feature flags
  • Custom percentage rollouts and targeting rules
  • A/B testing
Click Image to Enlarge

Flag management benefits:

  • Audit log
  • Custom roles
  • Custom webhooks
  • Integrations for Slack and HipChat

Mobile Android Feature Flags

Let's create a mobile Android feature flag for a "One Click Checkout"

1.In your build.gradle file, declare a dependency on the LaunchDarkly Android SDK:

Check out our open source mobile Android SDK on GitHub or read through the reference documentation.

               
       compile 'com.launchdarkly:launchdarkly-android-client:#.#.#'
                
              

2.Use the builder pattern to construct a user object:

You can pass us any data about users for targeting and segmentation.

               
          user = new LDUser.Builder("aa0ceb")
           .email("fake@example.com")
           .firstName("Jake")
           .lastName("Fake")
           .custom("group", "microsoft")
           .build();
                
              

3.Create a config object, then initialize the shared instance of LDClient

               
          LDConfig ldConfig = new LDConfig.Builder()
              .setMobileKey("YOUR_MOBILE_KEY")
              .build();

          LDClient ldClient = LDClient.init(this.getApplication(), ldConfig, user, 5);
                
              

4.Create a feature flag in LaunchDarkly

A flag allows you to manage a feature from the LaunchDarkly dashboard.

5.Wrap your code with a feature flag

Call BoolVariation to check the flag value for the user.

               
                  LDClient.get().BoolVariation("your.feature.key", user, false);
                      if (showFeature) {
                          // application code to show the feature
                      }
                      else {
                          // the code to run if the feature is off
                      }
                
              

6.Manage your flag

Use LaunchDarkly to determine which users see the feature.
You can roll out to a percentage of your users or target individual users/groups.


Create your own Android feature flags in minutes.
How It Works