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.

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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 Dashboard 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.

Android CI Download Coverage Status Javadocs Quality Gate Status License

Getting started

1. Install the package

Gradle:

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

2. Go to the ConfigCat Dashboard to get your SDK Key:

SDK-KEY

3. Import com.configcat.* to your application

import com.configcat.*

4. Create the ConfigCat client instance

val client = new ConfigCatClient("#YOUR-SDK-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 18 (Jelly Bean). 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.

Need help?

https://configcat.com/support

Contributing

Contributions are welcome. For more info please read the Contribution Guideline.

About ConfigCat

About

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.

Topics

Resources

License

Packages

No packages published

Languages