Configuration - Specifying Configuration Sources

Alternate Configuration Location

The SDK’s start method expects to find a configuration file in your project named foresee_configuration.json, by default, but it is possible to specify an alternate location using the following method:

startWithConfiguration(Application application, String filename);

This is especially useful when debugging. Specify a custom config file when running locally like this:

if (BuildConfig.DEBUG) {
  ForeSee.startWithConfiguration(this, "foresee_configuration_debug.json");
} else {
  ForeSee.start; // default config
}

Remote Configuration

It’s also possible to specify a JSON string directly:

String jsonConfig = "{\"clientId\":\"your_client_id\",\"customLogoName\":\"custom_logo.png\",\"notificationType\":\"IMMEDIATE\",\"sessionReplayEnabled\":true,\"measures\":[{\"surveyId\":\"app_test_2\",\"launchCount\": 0}]}";
ForeSee.startWithConfigurationJSON(this, jsonConfig);

This JSON string could originate anywhere (including one of your own servers), so this method can be used to load a remote configuration.

Other articles in this section:

  1. Configuration Options
  2. Configuration Structure
  3. Specifying Configuration Sources (current article)