Android SDK for Optimizely Feature Experimentation and Optimizely Full Stack (legacy)
This repository houses the Android SDK for use with Optimizely Feature Experimentation and Optimizely Full Stack (legacy). The Android SDK depends on the Optimizely Java SDK.
Optimizely Feature Experimentation is an A/B testing and feature management tool for product development teams, letting you experiment at every step. Using Optimizely Feature Experimentation allows for every feature on your roadmap to be an opportunity to discover hidden insights. Learn more at Optimizely.com, or see the developer documentation.
Optimizely Rollouts is free feature flags for development teams. You can easily roll out and roll back features in any application without code deploys, mitigating risk for every feature on your roadmap.
Refer to the Android SDK's developer documentation for detailed instructions on getting started with using the SDK.
To add the android-sdk and all modules to your project, include the following in your app's build.gradle
:
NOTE
Optimizely previously distributed the Android SDK through Bintray/JCenter. But, as of April 27, 2021, Bintray/JCenter will become a read-only repository indefinitely and the publish repository has been migrated to MavenCentral for the SDK version 3.10.1 and later. Older versions will still be available in JCenter.
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation 'com.optimizely.ab:android-sdk:4.0.0'
}
A sample code for SDK initialization and experiments:
OptimizelyManager optimizelyManager = OptimizelyManager.builder()
.withSDKKey("my_sdk_key")
.withDatafileDownloadInterval(TimeUnit.MINUTES.toSeconds(15))
.build(getApplicationContext());
optimizelyManager.initialize(this, null, (OptimizelyClient optimizely) -> {
OptimizelyClient optimizely = optimizelyManager.getOptimizely();
Variation variation = optimizely.activate("background_experiment", userId);
optimizely.track("sample_conversion", userId);
});
See the Optimizely Feature Experimentation developer documentation to learn how to set up your first Android project and use the SDK.
This project includes 5 library modules and a test app.
git clone [email protected]:optimizely/android-sdk.git
./gradlew assemble
./gradlew testAllModules
./gradlew test-app:installDebug
./gradlew tasks
./gradlew user-profile:tasks
Android Studio is an IDE that wraps gradle. Everything you can do in Android Studio can be done from the command line tools.
You can import this project into Android Studio by opening Android Studio and selecting Import Project
from the first dialog or from the File
menu. Simply select the project's root build.gradle
file and Android Studio will do the rest.
Tests can be run by right clicking the file in the project pane or by clicking the method name in source and selecting run. You will be prompted to create an AVD or connect a device if one isn't connected.
Please see CONTRIBUTING.
First-party code (under android-sdk/, datafile-handler/, event-handler/, shared/, user-profile/) is copyright Optimizely, Inc. and contributors, licensed under Apache 2.0
This software incorporates code from the following open source projects:
Optimizely.ab:core-api https://github.com/optimizely/java-sdk License (Apache 2.0): https://github.com/optimizely/java-sdk/blob/master/LICENSE Additional credits from java-sdk:https://github.com/optimizely/java-sdk/blob/master/README.md
Android Logger https://github.com/noveogroup/android-logger License (Public Domain): https://github.com/noveogroup/android-logger/blob/master/LICENSE.txt
Flutter - https://github.com/optimizely/optimizely-flutter-sdk
JavaScript - https://github.com/optimizely/javascript-sdk