Control feature rollout for certain user segments of your application with feature flags. To start using feature management in the platform, follow the instructions below to install the SDK and deploy a feature flag.
These same instructions are available in the platform UI. Select Installation from the left pane to use. |
To install the SDK:
-
Select
. -
Select an Environment from the options, or create an environment by completing the following:
-
Select CREATE ENVIRONMENT.
-
Enter an Environment name.
-
(Optional) Enter a Description.
-
(Optional) Select Approvers if you want to have a manual approval required before deployment.
-
(Optional) Enter any Properties you want to associate with the environment. For more information, refer to properties configuration and properties in an environment.
-
Select SUBMIT.
-
-
Select Android or Android TV, Fire TV from the language options.
-
Select Gradle from the platform type options.
-
Add the following code for the ROX package to the dependencies block of the
build.gradle
file in your application:compile group: 'io.rollout.rox', name: 'rox-android', version: '5.0.5'
-
Add the following code to the
AndroidManifest.xml
file in your application. Be sure to replace<YOUR-SDK-KEY>
with your SDK key:<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <meta-data android:name="rox.apiKey" android:value="<YOUR-SDK-KEY>" />
-
You must put the
uses-permission
tag outside the application tag, because it enables internet access for your application. -
You must put the
meta-data
tag inside the application tag. -
Your SDK key is a unique environment identifier. During SDK installation, the SDK key is displayed within the
Rox.setup
call.
-
-
Initialize the SDK by either of the following methods:
-
Add the following code to the
onCreate()
method of your application class:Rox.setup(this);
-
Add the following code to your main application class:
Rox.setup(this.getApplication());
-
-
Define the feature flags in a container class, as in the following code:
import io.rollout.configuration.RoxContainer; import io.rollout.flags.RoxFlag; import io.rollout.flags.RoxString; // Create the Flags container class public class Flags implements RoxContainer { //Define the feature flags public RoxFlag enableTutorial = new RoxFlag(false), public RoxString titleColors = new RoxString("White", new String[] {"White", "Blue", "Green", "Yellow"}) }
-
Finish by registering the flag container, setting up the SDK key, and configuring the flags, as in the following code:
-
Run your application and then select TEST INTEGRATION to confirm a successful connection.
After running the application, flags added in the code are automatically added to your feature flag list. |
You have installed an SDK and created flags in your application.
Refer to the SDK reference for more information. |