Launch generates a unique environment ID that the SDK uses to retrieve your configuration. This ID is generated by Adobe Launch when an app configuration is created and published to a given environment. The app is first launched, the SDK retrieves and uses this Adobe-hosted configuration.
{% hint style="success" %} Configuring the SDK with the Launch environment ID is highly recommended. {% endhint %}
After configuration is retrieved on the app's first launch, it is stored in local cache. Subsequent requests for configuration will cause continued use of cached configuration, unless configuration changes. If a network error occurs while downloading the configuration file, the local cache is used as the configuration.
Note, that no configuration changes are made if/when the following happen:
- No change from cached configuration
- Configuration retrieval fails (due to network or other considerations)
- File-read or parsing errors occurs.
The unique environment ID provided by Launch can be configured with the SDK using the following:
{% tabs %} {% tab title="Android" %}
void configureWithAppID(final String appId)MobileCore.ConfigureWithAppId("1423ae38-8385-8963-8693-28375403491d");{% endtab %}
{% tab title="iOS" %}
+ (void) configureWithAppId: (NSString* __nullable) appid;[ACPCore configureWithAppId :@"1423ae38-8385-8963-8693-28375403491d"];{% hint style="info" %}
Alternatively, you may also place the Launch environment ID in your iOS project's Info.plist with the ADBMobileAppID key. When the SDK is initialized, the environment ID is automatically read from the Info.plist file, and associated configuration
{% endhint %}
{% endtab %}
{% endtabs %}
You may also update configuration, programmatically by passing configuration keys and values to override existing configuration.
{% hint style="info" %} Keys not found on current configuration, will be added when this method is followed. Null values are allowed and will replace existing configuration values, if present. {% endhint %}
{% tabs %} {% tab title="Android" %}
void updateConfiguration(final Map configMap);HashMap<String, Object> data = new HashMap<String, Object>();
data.put("global.ssl", true);
data.put("global.timezone", "PDT");
data.put("global.timeoneOffset", -420);
MobileCore.updateConfiguration(data);{% endtab %}
{% tab title="iOS" %}
+ (void) updateConfiguration: (NSDictionary* __nullable) config;NSMutableDictionary *updatedConfig = [NSMutableDictionary dictionary];
[contextData setObject:@"newrsid" forKey:@"analytics.rsid"];
[ACPCore updateConfiguration:updatedConfig];{% endtab %} {% endtabs %}
To serve various use cases, you may also choose to include a bundled JSON configuration file in your app package to replace or complement using the Launch environment ID approach.
To download the JSON configuration file use the following URL:
``https://assets.adobedtm.com/PASTE-LAUNCH-ENVIRONMENT-ID.json``
- In iOS, the ADBMobileConfig.json file can be placed anywhere that it is accessible in your bundle.
- In Android, the ADBMobileConfig.json file must be placed in the assets folder.
You can also load a different ADBMobileConfig.json file by using the ConfigureWithFileInPath method. The Adobe Cloud Platform SDKs will attempt to load the file from the given path and parse its JSON contents. Previous programmatic configuration changes that were set by using the UpdateConfiguration method are applied on the bundled file's configuration before setting the new configuration to the Adobe Cloud Platform SDKs. If a file-read error or JSON parsing error occurs, no configuration changes are made.
To pass in a bundled path and file name:
{% tabs %} {% tab title="Android" %}
void configureWithFileInPath(final String filePath)MobileCore.configureWithFileInPath("absolute/path/to/exampleJSONfile.json");{% endtab %}
{% tab title="iOS" %}
+ (void) configureWithFileInPath: (NSString* __nullable) filepath;NSString *filePath = [[NSBundle mainBundle] pathForResource:@"ExampleJSONFile"ofType:@"json"];
[ACPCore configureWithFileInPath:filePath];{% endtab %} {% endtabs %}
Here's a sample JSON file for the SDK
{
"experienceCloud.org": "3CE342C75100435B0A490D4C@AdobeOrg",
"target.clientCode": "yourclientcode",
"target.timeout": 5,
"audience.server": "omniture.demdex.net",
"audience.timeout": 5,
"analytics.rsids": "mobilersidsample",
"analytics.server": "obumobile1.sc.omtrdc.net",
"analytics.aamForwardingEnabled": false,
"analytics.offlineEnabled": true,
"analytics.batchLimit": 0,
"analytics.backdatePreviousSessionInfo": false,
"global.privacy": "optedin",
"lifecycle.sessionTimeout": 300,
"rules.url": "https://link.to.rules/test.zip"
}