Example of Remote Config implementation¶
We present sample code for controlling banner frames with Remote Config.

Parameters to use
Parameter Name |
Variable Name |
Parameter Example |
Show Flag |
show_flag | true/false |
Banner destination URL |
banner_url | https://example.com/campaign/springYYYYMMDD/ |
Banner Image URL |
banner_img_url | https://example.com/img/XXX.png |
1. Set default parameters¶
Please refer to Create default parameters and set the default parameters as shown in the image.

2. Write code to use Remote Config¶
Please write the code to determine using the Remote Config at the location where you want to display the banner frame.
// Returns a Dictionary with key values
NSDictionary<NSString *, RPRRemoteConfigValue *> *values = [[Repro remoteConfig] allValues];
if (values[@"show_flag"] != nil && [values[@"show_flag"].stringValue isEqual: @"true"]) {
// Write code using `values[@"banner_url"]` and `values[@"banner_img_url"]`
}
// Returns a Dictionary with key values
let values: Dictionary<String, RPRRemoteConfigValue> = Repro.remoteConfig.allValues()
if let value = values["show_flag"], value.stringValue == "true" {
// Write code using `values["banner_url"]` and `values["banner_img_url"]`
}
// Returns a Dictionary with key values
Map<String, RemoteConfigValue> values = Repro.getRemoteConfig().getAllValues();
if (values.get("show_flag") != null && values.get("show_flag").equals("true")) {
// Write code using `values.get("banner_url")` and `values.get("banner_img_url")`
}
// Returns a Dictionary with key values
val values = Repro.getRemoteConfig().allValues
if (values["show_flag"] != null && values["show_flag"].toString() == "true") {
// Write code using `values["banner_url"]` and `values["banner_img_url"]`
}
// Returns a Map with all values.
std::map<std::string, RemoteConfigValue*> values = ReproCpp::getRemoteConfig().getAllValues();
if (values["show_flag"] != nullptr && values["show_flag"] == "true") {
// Write code using `values["banner_url"]` and `values["banner_img_url"]`
}
// Returns a Dictionary with all values.
Dictionary<string, RemoteConfigValue> values = Repro.RemoteConfig.GetAllValues();
if (values["show_flag"] != null && values["show_flag"] == "true") {
// Write code using `values["banner_url"]` and `values["banner_img_url"]`
}
// Returns an associative array with all values.
Repro.remoteConfig.getAllValues(
function(values) {
if (values["show_flag"] != null && values["show_flag"] == "true") {
// Write code using `values["banner_url"]` and `values["banner_img_url"]`
}
}
);
// Returns an associative array with all values.
Repro.remoteConfig.getAllValues((values) => {
if (values["show_flag"] != null && values["show_flag"] == "true") {
// Write code using `values["banner_url"]` and `values["banner_img_url"]`
}
});
// Returns a Map with all values.
var values = await Repro.remoteConfig.getAllValues();
if (values["show_flag"] != null && values["show_flag"].toString() == "true") {
// Write code using `values["banner_url"]` and `values["banner_img_url"]`
}
3. Create a Remote Config Campaign¶
Please refer to Create a Campaign to create a campaign that will be delivered to the users you wish to display the banner to

If you want to refer to the Remote Conifg on the screen that appears immediately after the application is launched¶
If you want to use Remote Conifg to switch the display for each user on the screen that appears immediately after the app starts, the latest values of the Remote Config will not be reflected until Repro's setup
completes. In that case, you can use fetch
to wait for the setup
to complete before using the values of the Remote Config. Define a callback function for fetch
before setup
and describe the process after the values are retrieved in that function.
An example code is presented below.
[[Repro remoteConfig] fetchWithTimeout:0 completionHandler:^(RPRRemoteConfigFetchStatus fetchStatus) {
if (fetchStatus == RPRRemoteConfigFetchStatusSuccess) {
[[Repro remoteConfig] activateFetched];
NSDictionary<NSString *, RPRRemoteConfigValue *> *values = [[Repro remoteConfig] allValues];
if (values["show_flag"] != null && values["show_flag"].toString() == "true") {
// Write code using `values["banner_url"]` and `values["banner_img_url"]`
}
}
}];
[Repro setup:@"YOUR_APP_TOKEN"];
Repro.remoteConfig.fetch(withTimeout: 0) { status in
if status == .success {
Repro.remoteConfig.activateFetched()
let values: Dictionary<String, RPRRemoteConfigValue> = Repro.remoteConfig.allValues()
if let value = values["show_flag"], value.stringValue == "true" {
// Write code using `values["banner_url"]` and `values["banner_img_url"]`
}
}
}
Repro.setup(token: "YOUR_APP_TOKEN")
Repro.getRemoteConfig().fetch(0, new RemoteConfigListener() {
@Override
public void onCompletion(FetchStatus status) {
if (status == FetchStatus.SUCCESS) {
Repro.getRemoteConfig().activateFetched();
Map<String, RemoteConfigValue> values = Repro.getRemoteConfig().getAllValues();
if (values.get("show_flag") != null && values.get("show_flag").equals("true")) {
// Write code using `values.get("banner_url")` and `values.get("banner_img_url")`
}
}
}
});
Repro.setup(this, YOUR_APP_TOKEN);
Repro.getRemoteConfig().fetch(0) { status ->
if (status == FetchStatus.SUCCESS) {
Repro.getRemoteConfig().activateFetched()
val values = Repro.getRemoteConfig().allValues
if (values["show_flag"] != null && values["show_flag"].toString() == "true") {
// Write code using `values["banner_url"]` and `values["banner_img_url"]`
}
}
}
Repro.setup(this, YOUR_APP_TOKEN)
ReproCpp::getRemoteConfig().fetch(0, [](ReproCpp::RemoteConfig::FetchStatus status) {
if (status == ReproCpp::RemoteConfig::FetchStatusSuccess) {
ReproCpp::getRemoteConfig().activateFetched();
std::map<std::string, RemoteConfigValue*> values = ReproCpp::getRemoteConfig().getAllValues();
if (values["show_flag"] != nullptr && values["show_flag"] == "true") {
// Write code using `values["banner_url"]` and `values["banner_img_url"]`
}
}
});
Repro.RemoteConfig.Fetch(0, (status) =>
{
if (status == Repro.FetchStatus.Success)
{
Repro.RemoteConfig.ActivateFetched();
Dictionary<string, RemoteConfigValue> values = Repro.RemoteConfig.GetAllValues();
if (values["show_flag"] != null && values["show_flag"] == "true")
{
// Write code using `values["banner_url"]` and `values["banner_img_url"]`
}
}
});
Repro.remoteConfig.fetch(0, function(status) {
// success callback
if (status == Repro.remoteConfig.FetchStatus.Success) {
Repro.remoteConfig.activateFetched(function(message) {
// success callback
Repro.remoteConfig.getAllValues(
function(values) {
if (values["show_flag"] != null && values["show_flag"] == "true") {
// Write code using `values["banner_url"]` and `values["banner_img_url"]`
}
}
);
}, function(message) {
// error callback
});
}
}, function(status) {
// error callback
});
Repro.remoteConfig.fetch(0, (status) => {
if (status == Repro.remoteConfig.FETCH_STATUS.REMOTE_CONFIG_SUCCESS) {
Repro.remoteConfig.activateFetched();
Repro.remoteConfig.getAllValues((values) => {
if (values["show_flag"] != null && values["show_flag"] == "true") {
// Write code using `values["banner_url"]` and `values["banner_img_url"]`
}
});
} else if (status == Repro.remoteConfig.FETCH_STATUS.REMOTE_CONFIG_TIMEOUT_REACHED) {
} else if (status == Repro.remoteConfig.FETCH_STATUS.REMOTE_CONFIG_ALREADY_FETCHED) {
}
});
await Repro.remoteConfig.fetch(0, (result) {
if (result == FetchStatus.success) {
await Repro.remoteConfig.activateFetched();
var values = await Repro.remoteConfig.getAllValues();
if (values["show_flag"] != null && values["show_flag"].toString() == "true") {
// Write code using `values["banner_url"]` and `values["banner_img_url"]`
}
}
});