Build your first mobile app with feature flags

5 minute read

In this tutorial we will build a working mobile application that demonstrates feature flags in action, connected to CloudBees Unify and responding to real-time flag changes without app rebuilding. Along the way we will encounter mobile SDK integration patterns, flag registration processes, and real-time evaluation workflows.

By the end, you will have a running mobile app with live feature flags and confidence in how feature flag integration works on mobile platforms.

Before we begin

Before we begin, ensure you have:

  • A CloudBees Unify account with feature management access.

  • Either Android Studio (for Android) or Xcode (for iOS) installed and working.

  • Git installed for cloning the sample repository.

  • Basic familiarity with your chosen mobile development platform.

Choose your mobile platform

We will work with either Android or iOS, as both platforms demonstrate the same feature flag concepts using platform-specific SDKs. Choose the platform you are most comfortable with, as the learning outcomes are identical.

Your choice will determine which sample repository we clone and which development environment we use. Both Android and iOS follow similar flag integration patterns, so the concepts you learn will apply regardless of your choice.

For Android development, you will need Android Studio and the ability to run Android emulators or connect physical devices. For iOS development, you will need Xcode and access to iOS Simulator (or physical iOS devices with developer certificates).

Clone and explore the sample application

Now we will get the sample application that already has feature flag integration built in. This saves us from implementing SDK integration from scratch and lets us focus on how feature flags work in practice.

For Android development:

  1. Clone the Android sample repository:

    git clone git@github.com:cloudbees-io/android-fm-example.git
  2. Open Android Studio and select File  Open.

  3. Navigate to the cloned android-fm-example directory and select it. Android Studio will import the project and resolve dependencies automatically.

For iOS development:

  1. Clone the iOS sample repository:

    git clone git@github.com:cloudbees-io/swift-ios-fm-example.git
  2. Navigate to the cloned directory and double-click the .xcodeproj file to open it in Xcode.

You will see a typical mobile application structure with additional files for feature flag integration. Notice the ROX SDK dependency files and flag definitions already present in the code, as we did not need to set these up manually.

Configure your SDK connection

Now we need to connect the sample app to your CloudBees Unify environment using an SDK key. This key tells the mobile app which CloudBees Unify environment to connect to for flag configurations.

  1. Sign in to CloudBees Unify and navigate to Feature management  Flags.

  2. Select your application from the available applications. If you have not created an application yet, you will see instructions for creating one.

  3. Copy the SDK key displayed on the page. The key will be a long alphanumeric string. Copy it exactly as shown.

Now we configure the sample app with your SDK key.

For Android:

  1. In Android Studio, open the AndroidManifest.xml file.

  2. Locate the following section:

    <meta-data android:name="rox.apiKey" android:value="your-cloudbees-sdk-key" />
  3. Replace your-cloudbees-sdk-key with the SDK key you copied from CloudBees Unify.

For iOS:

  1. In Xcode, open the project settings or configuration file where the SDK key is specified.

  2. Replace the placeholder SDK key value with the key you copied from CloudBees Unify.

The sample app is now connected to your CloudBees Unify environment and ready to synchronize feature flags.

Run the app and verify SDK integration

Let us build and run the app to verify that feature flag integration works correctly. The app should launch successfully and display the current state of its feature flags.

For Android:

  1. In Android Studio, select a target device (emulator or connected phone).

  2. Select Run  Run 'app' or press the green play button. The app will build and deploy to your selected device.

For iOS:

  1. In Xcode, select a target simulator or connected device.

  2. Select Product  Run or press Cmd+R to build and run the app.

The app will launch and display its user interface. You should see various UI elements that demonstrate different types of feature flags in action. The app should start without any network connection errors. If you see errors, check that your SDK key was copied correctly.

Notice the current behavior of the feature flags shown in the app interface. These reflect the default values defined in the app code, since we have not yet modified them in CloudBees Unify.

Observe automatic flag registration

One of the powerful features of CloudBees Unify feature management is automatic flag discovery. When the app connects for the first time, it automatically registers its flags with CloudBees Unify.

  1. Return to CloudBees Unify and refresh the Feature management page.

  2. You should now see several flags that match the names defined in the sample app code. The flags appear automatically without manual creation. This is the SDK registering them on first connection.

The flags you see represent the different feature flag types implemented in the sample app: boolean flags for feature toggles, string flags for text and color variations, and numeric flags for timing or sizing adjustments.

Each flag shows its current value and configuration status. Notice that some flags may be set to "Off" initially. This means they will use their default values from the app code.

Test real-time flag updates

Now we will experience the core benefit of feature flags: the ability to change app behavior instantly without rebuilding or redeploying.

  1. In CloudBees Unify, locate one of the boolean flags (such as enableTutorial or showMessage).

  2. Toggle the Configuration status to On if it is not already enabled.

  3. Change the flag value from its current setting to the opposite value.

  4. Select Save to apply the changes.

  5. Return to the running mobile app within a few seconds.

You will see the app interface change immediately to reflect your flag modification. The change happens without restarting the app or rebuilding any code. This is real-time flag evaluation in action.

Try this process with several different flags to see how each type of change affects the app behavior.

Explore different flag types

The sample app demonstrates several types of feature flags that address common mobile development scenarios. Let us explore each type to understand their different use cases.

Boolean flags control feature availability:

  1. Find a boolean flag like enableTutorial in CloudBees Unify.

  2. Toggle it between true and false while observing the app. You will see UI elements appear or disappear based on the flag state.

String flags control text, colors, and other string-based variations:

  1. Locate a string flag such as titleColors or displayText.

  2. Change its value to one of the predefined options (such as "Blue", "Green", "Yellow"). The app will immediately update to display the new text or color.

Numeric flags control timing, sizing, and numeric parameters:

  1. Find a numeric flag like fontSize or animationDuration.

  2. Adjust the value within the allowed range. The app will reflect the numeric change in its behavior or appearance.

Each flag type solves different problems in mobile development: feature toggles for gradual rollouts, string variations for A/B testing different copy or themes, and numeric adjustments for performance tuning.

Notice how all changes take effect immediately without any app restart or code deployment. This capability enables rapid iteration and safe experimentation in production mobile applications.

What we accomplished

We have built a working mobile application with live feature flag integration that responds to real-time configuration changes without rebuilding. Along the way we encountered mobile SDK integration patterns, automatic flag registration, and real-time evaluation workflows.

You now have hands-on experience with feature flags on mobile platforms and understand how they enable rapid iteration without traditional deployment cycles.

From here, you might want to:

Verification checklist