import com.featureprobe.mobile.*;
val url = FpUrlBuilder("https://featureprobe.io/server").build();
val userId = /* unique user id in your business logic */
val user = FpUser(userId)
user.with("name", "bob")
val config = FpConfig(url!!, "client-9d885a68ca2955dfb3a7c95435c0c4faad70b50d", 10u, true)
val fp = FeatureProbe(config, user)
Step 3. Use the feature toggle
val showFeature = fp.boolValue("header_skin", false)
if (showFeature) {
// application code to show the feature
} else {
// the code to run if the feature is off
}
Step 4. Unit Testing (Optional)
val fp_for_test = FeatureProbe.newForTest("{ \"toggle_1\": true }")
val is_true = fp_for_test.boolValue("toggle_1", false)
assert(is_true == true)
1. add `pod 'FeatureProbe', :git => 'git@github.com:FeatureProbe/client-sdk-ios.git'` to Podfile
2. `pod install` or `pod update`
Step 2. Create a FeatureProbe instance
import featureprobe
let url = FpUrlBuilder(remoteUrl: "https://featureprobe.io/server").build();
let userId = /* unique user id in your business logic */
let user = FpUser(key: userId)
user.with(key: "name", value: "bob")
let config = FpConfig(
remoteUrl: url!,
clientSdkKey: "client-9d885a68ca2955dfb3a7c95435c0c4faad70b50d",
refreshInterval: 10,
waitFirstResp: true
)
let fp = FeatureProbe(config: config, user: user)
Step 3. Use the feature toggle
let showFeature = fp.boolValue(key: "header_skin", defaultValue: false)
if showFeature {
// application code to show the feature
} else {
// the code to run if the feature is off
}
Step 4. Unit Testing (Optional)
let fp2 = FeatureProbe.newForTest(toggles: "{ \"toggle_1\": true }")
let is_true = fp2.boolValue(key: "toggle_1", defaultValue: false)
assert(is_true == true);
bool showFeature = [fp boolValueWithKey: @"header_skin" defaultValue: false];
if (showFeature) {
// application code to show the feature
} else {
// the code to run if the feature is off
}
We are working on continue evolving FeatureProbe core, making it flexible and easier to use.
Development of FeatureProbe happens in the open on GitHub, and we are grateful to the
community for contributing bugfixes and improvements.
Please read CONTRIBUTING
for details on our code of conduct, and the process for taking part in improving FeatureProbe.
FeatureProbe Client Side SDK for Mobile Apps
Feature Probe is an open source feature management service. This SDK is used to control features in mobile programs.
Basic Terms
Reading the short Basic Terms will help to understand the code blow more easily. 中文
Getting started
In this guide we explain how to use feature toggles in an application using FeatureProbe.
Android Usage
Kotlin
Step 1. Install SDK
Step 2. Create a FeatureProbe instance
Step 3. Use the feature toggle
Step 4. Unit Testing (Optional)
Find the Demo code in example
iOS Usage
Swift
Step 1. Install SDK
Swift Package Manager:
Cocoapods:
Step 2. Create a FeatureProbe instance
Step 3. Use the feature toggle
Step 4. Unit Testing (Optional)
Find the Demo code in example
Objective-C
Step 1. Install SDK
Cocoapods
add
pod 'FeatureProbe', :git => 'git@github.com:FeatureProbe/client-sdk-ios.git'
to Podfilepod install
orpod update
Step 2. Create a FeatureProbe instance
Step 3. Use the feature toggle
Step 4. Unit Testing (Optional)
Find the Demo code in example
Testing
Contributing
We are working on continue evolving FeatureProbe core, making it flexible and easier to use. Development of FeatureProbe happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements.
Please read CONTRIBUTING for details on our code of conduct, and the process for taking part in improving FeatureProbe.