Use this example application to integrate with CloudBees platform and test feature management. After integrating, observe the application display changes in response to updates you make to flag values in {KPRODUCT}
In the example Kotlin application, the ROX SDK is already set up, and feature flags are already coded in.
Get started with the android-fm-example project
To get started with the android-fm-example project, follow these steps:
-
Clone the repository:
-
Using Git, clone the android-fm-example repository to your local machine:
git clone git@github.com:cloudbees-io/android-fm-example.git
-
Build and open the project:
-
In Android Studio, select
and open the cloned repository. -
If you are using an emulator, start the emulator.
-
-
Locate and copy the SDK key:
-
Navigate to
. -
Select an application.
-
Select
next to the SDK key on the page.
If you do not see an SDK key:
-
Navigate to
. -
Select Installation instructions in the upper-right corner.
-
Follow the installation instructions to complete the installation.
-
The SDK key will appear once an application is linked to an environment.
-
Close the installation instructions, and copy the SDK Key.
-
-
-
Reopen your project in Android Studio.
-
You must add the SDK key to your Cloudbees account: In the
AndroidManifest.xml
file, replace the<Your Cloudbees SDK Key>
with your corresponding API key:<meta-data android:name="rox.apiKey" android:value="<Your Cloudbees SDK Key>" />
-
In Android Studio, select
to run the android-fm-example application.
After running the application, the flags displayed in Feature flags in the example application. are automatically added to your Flags dashboard in CloudBees platform.
View the imported flags
Now that your application is running:
-
In CloudBees platform, select Feature management.
-
Select your example application to display the available flags as shown in the table below.
Table 1. Feature flags in the example application. Flag name Flag type Description showMessage
Boolean
Turns the message on or off.
message
String
Sets the message text.
fontSize
Number (Int for Python)
Sets the message font size in pixels. The flag value has the following variations:
12
,16
, or24
.fontColor
String
Sets the message font color. The flag value has the following variations:
red
,green
, orblue
.
Apply changes to flags in the UI
-
Select Feature management.
-
Select the application.
-
Select
next to the flag you want to configure.
-
Select Configure.
-
Select the Environment.
-
Update a flag value and save your changes.
-
Set the Configuration status to On.
-
The updated flag value is reflected in the display of the application.
Use the application with multiple SDK keys
Run multiple instances of the SDK in a single application, each with its own SDK key and environment. Each instance is fully isolated. Use this when you need to read or compare flags across environments without redeploying, support multi-tenant routing, or combine server-side and client-side evaluations in one application.
To use multiple SDK keys in the example Kotlin Android application, follow these steps:
-
Retrieve the SDK keys for the environments you’ll use.
-
Initialize a separate SDK instance for each key.
-
Decide how to route requests to instances (for example, by tenant, region, or environment selector).
-
Perform register/fetch/stream setup on each instance as required by your SDK.
-
Evaluate flags using the selected instance. Pass a consistent user/context object for accurate targeting.
-
Tag logs or metrics by instance, and shut down instances you no longer need.
For more information about using multiple SDK keys, refer to Manage multiple SDK keys in your application.
Documentation reference
Refer to Install the SDK for more information