Skip to content
Android SDK for ConfigCat. ConfigCat is a hosted feature flag service: https://configcat.com. Manage feature toggles across frontend, backend, mobile, desktop apps. Alternative to LaunchDarkly. Management app + feature flag SDKs.
Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper android 23 compatibility Jul 1, 2019
media readme update Apr 2, 2019
samples/android android sdk version update Jul 10, 2019
src add getAllKeys() function Jul 28, 2019
.DS_Store Small fixes Oct 7, 2018
.gitignore readme update Apr 2, 2019
.travis.yml Update .travis.yml Jul 2, 2019
LICENSE Initial commit Apr 7, 2018
README.md Update README.md Aug 9, 2019
build.gradle Merge branch 'master' into dev Jul 16, 2019
gradle.properties add getAllKeys() function Jul 28, 2019
gradlew build fix Jul 2, 2019
gradlew.bat Initial commit Apr 7, 2018
settings.gradle java -> android Jul 2, 2019

README.md

ConfigCat SDK for Android

https://configcat.com

ConfigCat SDK for Android provides easy integration for your application to ConfigCat.

ConfigCat is a feature flag and configuration management service that lets you separate releases from deployments. You can turn your features ON/OFF using ConfigCat Management Console even after they are deployed. ConfigCat lets you target specific groups of users based on region, email or any other custom user attribute.

ConfigCat is a hosted feature flag service. Manage feature toggles across frontend, backend, mobile, desktop apps. Alternative to LaunchDarkly. Management app + feature flag SDKs.

Build Status Downloadl Coverage Status Javadocs License

Getting started

1. Install the package

Gradle:

implementation 'com.configcat:configcat-android-client:1.+'

2. Go to Connect your application tab to get your API Key:

API-KEY

3. Import com.configcat.* to your application

import com.configcat.*

4. Create the ConfigCat client instance

val client = new ConfigCatClient("#YOUR-API-KEY#")

5. Get your setting value:

val isMyAwesomeFeatureEnabled = client.getValue(Boolean::class.javaObjectType, "isMyAwesomeFeatureEnabled", false)
if(isMyAwesomeFeatureEnabled) {
    doTheNewThing()
} else{
    doTheOldThing()
}

Or use the async APIs:

client.getValueAsync(Boolean::class.javaObjectType, "isMyAwesomeFeatureEnabled", false)
    .thenAccept({ isMyAwesomeFeatureEnabled ->
        if(isMyAwesomeFeatureEnabled) {
            doTheNewThing()
        } else {
            doTheOldThing()
        }
    })

You also have to put this line into your manifest xml to enable the library access to the network.

<uses-permission android:name="android.permission.INTERNET" />

The minimum supported sdk version is 23 (Marshmallow). Java 1.8 or later is required.

Getting user specific setting values with Targeting

Using this feature, you will be able to get different setting values for different users in your application by passing a User Object to the getValue() function.

Read more about Targeting here.

User object

Percentage and targeted rollouts are calculated by the user object you can optionally pass to the configuration requests. The user object must be created with a mandatory identifier parameter which should uniquely identify each user:

val user = User.newBuilder().build("#USER-IDENTIFIER#") // mandatory

val isMyAwesomeFeatureEnabled = client.getValue(Boolean::class.javaObjectType, "isMyAwesomeFeatureEnabled", user, false)
if(isMyAwesomeFeatureEnabled) {
    doTheNewThing()
} else{
    doTheOldThing()
}

Sample/Demo app

Polling Modes

The ConfigCat SDK supports 3 different polling mechanisms to acquire the setting values from ConfigCat. After latest setting values are downloaded, they are stored in the internal cache then all requests are served from there. Read more about Polling Modes and how to use them at ConfigCat Java Docs or ConfigCat Android Docs.

Support

If you need help how to use this SDK feel free to to contact the ConfigCat Staff on https://configcat.com. We're happy to help.

Contributing

Contributions are welcome.

About ConfigCat

You can’t perform that action at this time.