Repro - Mobile Analytics for growth
日本語
Sign Up Back to Dashboard
  • System Requirements
  • Dashboard Guide
  • Development Guide
    • Signup
    • iOS/Android SDK
      • Get Started
      • Session Lifecycle
      • User ID
      • Device ID
      • User Profile
      • Event Tracking
      • Push Notification
      • NewsFeed
      • In-App Message
      • Silver Egg Recommendation Messages
      • Remote Config
        • Remote Config interface
          • Setting Local defaults
        • Access to Remote Config values
          • Single value
          • Whole Remote Config
          • All items with a certain prefix
          • Reset values
          • Fetch & Activate
      • WebView
      • Opt-out feature
      • Settings regarding the collection of advertiser IDs
      • Registering an user device into a specific audience with the help of a QR code
      • Set attribution data from Adjust to Repro
      • Set attribution data from AppsFlyer to Repro
      • Log Level
      • Verification Method
    • Web
    • Audience API
    • Audience Import(β)
    • Push API
    • User Profile API
    • User Profile Bulk Import
    • NewsFeed API
    • Deletion Targeted User Registration API
    • Booster installation guide
    • Mail(β)
  • Release Notes
  • FAQ

Remote Config¶

Remote Config interface¶

Accsess to Remote Config API is possible via the bellow API:

[Repro remoteConfig]
Repro.remoteConfig
Repro.getRemoteConfig()
Repro.getRemoteConfig()
ReproCpp::getRemoteConfig()
Repro.RemoteConfig
Repro.remoteConfig
Repro.remoteConfig
Repro.remoteConfig

Setting Local defaults¶

Two methods are available

From a Dictionary/Map/JSON¶

// setDefaultsFromDictionary must be executed before [Repro setup].
[[Repro remoteConfig] setDefaultsFromDictionary: @{ @"key1": @"value1", @"key2": @"value2" }];
// setDefaults must be executed before Repro.setup().
Repro.remoteConfig.setDefaults(fromDictionary: ["key1": "value1", "key2": "value2"]);
// setDefaultsFromMap must be executed before Repro.setup().
HashMap<String, Object> values = new HashMap<>();
values.put("key1", "value1");
values.put("key2", "value2");
Repro.getRemoteConfig().setDefaultsFromMap(values);
// setDefaultsFromMap must be executed before Repro.setup().
val values: HashMap<String, Any> = HashMap()
values["key1"] = "value1"
values["key2"] = "value2"
Repro.getRemoteConfig().setDefaultsFromMap(values)
// setDefaultsFromMap must be executed before ReproCpp::setup().
std::map<std::string, std::string> defaults;
defaults["key1"] = "value1";
defaults["key2"] = "value2";
ReproCpp::getRemoteConfig().setDefaultsFromMap(defaults);
// SetDefaultsFromMap must be executed before Repro.Setup().
var dic = new Dictionary<string, object>();
dic.Add("key1", "value1");
dic.Add("key2", "value2");
Repro.RemoteConfig.SetDefaultsFromMap(dic);
// setDefaultsFromJson must be executed before Repro.setup().
Repro.remoteConfig.setDefaultsFromJson(
    {"key1": "value1", "key2": "value2"},
    function(message) {
        // success callback
    },
    function(message) {
        // error callback
    }
);
Repro.remoteConfig.setDefaultsFromDictionary({
    key1: "value1",
    key2: "value2",
});
Repro.remoteConfig.setDefaultsFromMap({
    'key1' : 'value1',
    'key2' : 'value2',
});

From a raw Json string¶

// setDefaultsFromJsonString must be executed before [Repro setup].
[[Repro remoteConfig] setDefaultsFromJsonString: @"{\"key1\": \"value1\", \"key2\": \"value2\"}"];
// setDefaults must be executed before Repro.setup().
Repro.remoteConfig.setDefaults(fromJsonString: "{\"key1\": \"value1\", \"key2\": \"value2\"}")
// setDefaultsFromJsonString must be executed before Repro.setup().
Repro.getRemoteConfig().setDefaultsFromJsonString("{\"key1\": \"value1\", \"key2\": \"value2\"}");
// setDefaultsFromJsonString must be executed before Repro.setup().
Repro.getRemoteConfig().setDefaultsFromJsonString("{\"key1\": \"value1\", \"key2\": \"value2\"}")
// setDefaultsFromJsonString must be executed before ReproCpp::setup().
ReproCpp::getRemoteConfig().setDefaultsFromJsonString("{\"key1\": \"value1\", \"key2\": \"value2\"}");
// SetDefaultsFromJsonString must be executed before Repro.Setup().
Repro.RemoteConfig.SetDefaultsFromJsonString("{\"key1\": \"value1\", \"key2\": \"value2\"}");
// setDefaultsFromJsonString must be executed before Repro.setup().
Repro.remoteConfig.setDefaultsFromJsonString(
    "{\"key1\": \"value1\", \"key2\": \"value2\"}",
    function(message) {
        // success callback
    },
    function(message) {
        // error callback
    }
);
Repro.remoteConfig.setDefaultsFromJsonString("{\"key1\": \"value1\", \"key2\": \"value2\"}");
await Repro.remoteConfig.setDefaultsFromJsonString("{\"key1\": \"value1\", \"key2\": \"value2\"}");

Access to Remote Config values¶

Single value¶

To retrieve a specific value, specify the key as an exact match.

// The return value of [[Repro remoteConfig] valueForKey: "key1"] is always an RPRRemoteConfigValue instance and will never be nil.
NSString *string = [[Repro remoteConfig] valueForKey: @"key1"].stringValue;
// The return value of Repro.remoteConfig.value(forKey: 'key1') is always an RPRRemoteConfigValue instance and will never be nil.
if let value: String = Repro.remoteConfig.value(forKey: "key1").stringValue {
    // ... use value ...
    // stringValue will be nil if 'key1' is not found in
    // either the remote config or the local fallback
}
// The return value of Repro.getRemoteConfig().get('key1') is always an RPRRemoteConfigValue instance and will never be nil.
// If no value exists for a given key, the RemoteConfigValue's asString() returns null, but toString() returns an empty string.
String value = Repro.getRemoteConfig().get("key1").asString();
// The return value of Repro.getRemoteConfig().get('key1') is always an RPRRemoteConfigValue instance and will never be nil.
// If no value exists for a given key, the RemoteConfigValue's asString() returns null, but toString() returns an empty string.
val value = Repro.getRemoteConfig().get("key1").asString()
// The return value of ReproCpp::getRemoteConfig().get("key1") is always an RPRRemoteConfigValue instance and will never be nil.
const char* value = ReproCpp::getRemoteConfig().get("key1").getStringValue();
// The return value of Repro.RemoteConfig.Get("key1") is always an RPRRemoteConfigValue instance and will never be nil.
string value = Repro.RemoteConfig.Get("key1").AsString();
// If no value exists for the given key, the value returned by the success callback will be null.
Repro.remoteConfig.getValue(
    "key1",
    function(value) {
        const stringValue = value;
        // success callback
    },
    function(message) {
        // error callback
    }
);
// If no value exists for the given key, the value returned by the callback will be null.
Repro.remoteConfig.getValue("key1", (value) => {
    let string = value.toString();
});
// The return value of Repro.remoteConfig.get('key1') is always an RPRRemoteConfigValue instance and will never be nil.
var remoteConfigValue = await Repro.remoteConfig.get('key1');
var stringValue = remoteConfigValue.asString();

Whole Remote Config¶

Use allValues to get all values.

// Returns a Dictionary with all values.
NSDictionary<NSString *, RPRRemoteConfigValue *> *values = [[Repro remoteConfig] allValues]
// Returns a Dictionary with all values.
var values: Dictionary<NSString, RPRRemoteConfigValue> = Repro.remoteConfig.allValues()
// Returns a Map with all values.
Map<String, RemoteConfigValue> values = Repro.getRemoteConfig().getAllValues();
// Returns a Map with all values.
Map<String, RemoteConfigValue> values = Repro.getRemoteConfig().getAllValues()
// Returns a Map with all values.
std::map<std::string, RemoteConfigValue*> = ReproCpp::getRemoteConfig().getAllValues();
// Returns a Dictionary with all values.
Dictionary<string, RemoteConfigValue> value = Repro.RemoteConfig.GetAllValues();
// Returns an associative array with all values.
Repro.remoteConfig.getAllValues(
    function(values) {
        // success callback
    }
);
// Returns an associative array with all values.
Repro.remoteConfig.getAllValues((values) => {
    console.log(values);
});
// Returns a Map with all values.
var values = await Repro.remoteConfig.getAllValues();

All items with a certain prefix¶

If you want to get all the values of a key whose first letter matches a specific keyword, specify the prefix.

// Returns a Dictionary with key values ​​starting with "color".
NSDictionary<NSString *, RPRRemoteConfigValue *> *values = [[Repro remoteConfig] allValuesWithPrefix: @"color"]
// Returns a Dictionary with key values ​​starting with "color".
var values: Dictionary<NSString, RPRRemoteConfigValue> = Repro.remoteConfig.allValues(withPrefix: "color")
// Returns a Map with key values ​​starting with "color".
Map<String, RemoteConfigValue> values = Repro.getRemoteConfig().getAllValuesWithPrefix("color");
// Returns a Map with key values ​​starting with "color".
Map<String, RemoteConfigValue> values = Repro.getRemoteConfig().getAllValuesWithPrefix("color")
// Returns a Map with key values ​​starting with "color".
std::map<std::string, RemoteConfigValue*> = ReproCpp::getRemoteConfig().getAllValuesWithPrefix("color");
// Returns a Dictionary with key values ​​starting with "color".
Dictionary<string, RemoteConfigValue> value = Repro.RemoteConfig.GetAllValuesWithPrefix("color");
// Returns an associative array with key values ​​starting with "color".
Repro.remoteConfig.getAllValuesWithPrefix("color",
    function(values) {
        // success callback
    }
);
// Returns an associative array with key values ​​starting with "color".
Repro.remoteConfig.getAllValuesWithPrefix("color", (values) => {
    console.log(values);
});
// Returns a Map with key values ​​starting with "color".
var values = await Repro.remoteConfig.getAllValuesWithPrefix("color");

Reset values¶

If you want to return the Remote Config object to its initial state, you may call forceReset(). After forceReset() is executed, you will need to set the local default values and callbacks again.

[[Repro remoteConfig] forceReset]
Repro.remoteConfig.forceReset()
Repro.getRemoteConfig().forceReset()
Repro.getRemoteConfig().forceReset()
ReproCpp::getRemoteConfig().forceReset()
Repro.RemoteConfig.ForceReset()
Repro.remoteConfig.forceReset()
Repro.remoteConfig.forceReset()
await Repro.remoteConfig.forceReset()

Fetch & Activate¶

Everytime the app enters foreground, Remote Config values wil be retrieved from the Repro server & automatically activated. Therefore, a fetch callback is not necessary. If you want to control when to apply the fetched values, you can call activateFetched() . If you want to switch old Remote Config values for new values at a certain point in time after they have been retrieved, setting a callback is recommended.

  • Only one callback can be set

  • The callback is not guaranteed to be called.

  • It is also possible to update elements on the UI in the callback.

  • After fetch() is executed, the actual processing and callbacks are not executed until a timeout or Repro.setup() is called.

  • activateFetched() should be executed after the callback has been executed. From within the callback block is of course also possible.

fetch example

// The timeout is specified in seconds using NSTimeInterval.
[[Repro remoteConfig] fetchWithTimeout:3.0 completionHandler:^(RPRRemoteConfigFetchStatus fetchStatus) {
    if (fetchStatus == RPRRemoteConfigFetchStatusSuccess) {
        NSDictionary<NSString *, RPRRemoteConfigValue *> *oldValues = [[Repro remoteConfig] allValues];
        for (id key in [oldValues keyEnumerator]) {
            NSLog(@"OLD Remote Config Key:%@ Value:%@", key, [oldValues valueForKey:key]);
        }

        [[Repro remoteConfig] activateFetched];

        NSDictionary<NSString *, RPRRemoteConfigValue *> *newValues = [[Repro remoteConfig] allValues];
        for (id key in [newValues keyEnumerator]) {
            NSLog(@"OLD Remote Config Key:%@ Value:%@", key, [newValues valueForKey:key]);
        }
    }
}];
// The timeout is specified in seconds using NSTimeInterval.
Repro.remoteConfig.fetch(withTimeout: 3.0) { status in
    if status == .success {
        print("OLD Remote Config Values: \(Repro.remoteConfig.allValues())")
        Repro.remoteConfig.activateFetched()
        print("NEW Remote Config Values: \(Repro.remoteConfig.allValues())")
    }
}
// The timeout is specified in milliseconds.
Repro.getRemoteConfig().fetch(3000, new RemoteConfigListener() {
    @Override
    public void onCompletion(FetchStatus status) {
        if (status == FetchStatus.SUCCESS) {
            Log.d("remote_config", "BEFORE " + Repro.getRemoteConfig().getAllValues().toString());
            Repro.getRemoteConfig().activateFetched();
            Log.d("remote_config", "AFTER  " + Repro.getRemoteConfig().getAllValues().toString());
        }
    }
});
// The timeout is specified in milliseconds.
Repro.getRemoteConfig().fetch(3000) { status ->
    if (status == FetchStatus.SUCCESS) {
        Log.d("remote_config", "BEFORE " + Repro.getRemoteConfig().allValues.toString())
        Repro.getRemoteConfig().activateFetched()
        Log.d("remote_config", "AFTER  " + Repro.getRemoteConfig().allValues.toString())
    }
}
// The timeout is specified in seconds.
ReproCpp::getRemoteConfig().fetch(3, [](ReproCpp::RemoteConfig::FetchStatus status) {
    if (status == ReproCpp::RemoteConfig::FetchStatusSuccess) {
        log("fetch result: FetchStatusSuccess");
        ReproCpp::getRemoteConfig().activateFetched();
    }
});
// The timeout is specified in milliseconds.
Repro.RemoteConfig.Fetch(3000, (status) =>
{
    if (status == Repro.FetchStatus.Success)
    {
        var str = string.Join(", ", Repro.RemoteConfig.GetAllValues().Select(elem => elem.Key + " => " + elem.Value.ToString()).ToArray());
        Debug.Log("RemoteConfig Values(Before ActivateFetched): " + str);

        Repro.RemoteConfig.ActivateFetched();

        str = string.Join(", ", Repro.RemoteConfig.GetAllValues().Select(elem => elem.Key + " => " + elem.Value.ToString()).ToArray());
        Debug.Log("RemoteConfig Values(After ActivateFetched): " + str);
    }
});
// The timeout is specified in milliseconds.
Repro.remoteConfig.fetch(3000, function(status) {
    // success callback
    if (status == Repro.remoteConfig.FetchStatus.Success) {
        Repro.remoteConfig.getAllValues((values) => {
            console.log(values);
            Repro.remoteConfig.activateFetched(function(message) {
                // success callback
                Repro.remoteConfig.getAllValues((values) => {
                    console.log(values);
                });
            }, function(message) {
                // error callback
            });
        });
    } else if (status == Repro.remoteConfig.FetchStatus.AlreadyFetched) {
    }
}, function(status) {
    // error callback
});
// The timeout is specified in milliseconds.
Repro.remoteConfig.fetch(3000, (status) => {
    if (status == Repro.remoteConfig.FETCH_STATUS.REMOTE_CONFIG_SUCCESS) {
        Repro.remoteConfig.getAllValues((values) => {
            console.log(values);
            Repro.remoteConfig.activateFetched();
            Repro.remoteConfig.getAllValues((values) => {
                console.log(values);
            });
        });
    } else if (status == Repro.remoteConfig.FETCH_STATUS.REMOTE_CONFIG_TIMEOUT_REACHED) {
    } else if (status == Repro.remoteConfig.FETCH_STATUS.REMOTE_CONFIG_ALREADY_FETCHED) {
    }
});
// The timeout is specified in milliseconds.
await Repro.remoteConfig.fetch(3000, (result) {
if (result == FetchStatus.success) {
    var values = await Repro.remoteConfig.getAllValues();
    for (var key in values.keys) {
        debugPrint('[old RemoteConfig] $key: ${values[key]}');
    }
    await Repro.remoteConfig.activateFetched();
    values = await Repro.remoteConfig.getAllValues();
    for (var key in values.keys) {
        debugPrint('[new RemoteConfig] $key: ${values[key]}');
    }
}
});
  • « Silver Egg Recommendation Messages
  • WebView »

About Us Careers Terms of Service Privacy Policy Cookie Policy

© 2022 Repro Inc.