Configuration
The Configuration extension is built into the Mobile Core extension. It provides several different APIs for you to setup the configuration either remotely in the Data Collection UI or locally.

Configure with App ID per environment

When you configure a mobile property, a unique environment ID is generated that the SDK uses to retrieve your configuration. This ID is generated when an app configuration is created and published to a given environment. The app is first launched and then the SDK retrieves and uses this Adobe-hosted configuration.
As best practice, you should configure a mobile property in the Data Collection UI and use environment IDs to configure your application. Follow the steps in Set up a mobile property if you need to create a new Experience Platform App.
After the configuration is retrieved when the app is initially launched, the configuration is stored in local cache. The SDK tries to refresh the configuration every cold launch or when a new session is detected. If there is no change or a network request error occurs while downloading the configuration file, the cached configuration will be used.
The unique environment ID from the Data Collection UI can be configured with the SDK using the following:
Android
iOS (AEP 3.x)
iOS (ACP 2.x)
Cordova
Unity
Xamarin

Java

Syntax
1
public static void configureWithAppID(final String appId);
Copied!
Example
1
MobileCore.configureWithAppId("1423ae38-8385-8963-8693-28375403491d");
Copied!

Swift

Syntax
1
static func configureWith(appId: String)
Copied!
Example
1
MobileCore.configureWith(appId: "1423ae38-8385-8963-8693-28375403491d")
Copied!

Objective-C

Syntax
1
+ (void) configureWithAppId: (NSString* appId);
Copied!
Example
1
[AEPMobileCore configureWithAppId: @"1423ae38-8385-8963-8693-28375403491d"];
Copied!
Alternatively, you can also place the 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 the associated configuration.

Swift

Syntax
1
static func configure(withAppId: String)
Copied!
Example
1
ACPCore.configure(withAppId: "1423ae38-8385-8963-8693-28375403491d")
Copied!

Objective-C

Syntax
1
+ (void) configureWithAppId: (NSString* __nullable) appid;
Copied!
Example
1
[ACPCore configureWithAppId:@"1423ae38-8385-8963-8693-28375403491d"];
Copied!
Alternatively, you can also place the 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 the associated configuration.
Cordova
When using Cordova, the configureWithAppId method call must be done in native code which is shown under the Android and iOS tabs.

C#

Syntax
1
void ConfigureWithAppID([NullAllowed] string appid);
Copied!
Example
1
ACPCore.ConfigureWithAppID("1423ae38-8385-8963-8693-28375403491d");
Copied!

C#

Syntax
1
public static void ConfigureWithAppID(string appId);
Copied!
Example
1
ACPCore.ConfigureWithAppID("1423ae38-8385-8963-8693-28375403491d");
Copied!

Programmatic updates to configuration

You can also update the configuration programmatically by passing configuration keys and values to override the existing configuration.
Keys that are not found on the current configuration are added when this method is followed. Null values are allowed and replace existing configuration values.
Do not use this API to update the build.environment or any key with an environment prefix, because it can lead to unexpected behavior. For more information, read Environment-aware configuration properties.
Android
iOS (AEP 3.x)
iOS (ACP 2.x)
React Native
Flutter
Cordova
Unity
Xamarin

Java

Syntax
1
public static void updateConfiguration(final Map<String, Object> configMap);
Copied!
Example
1
HashMap<String, Object> data = new HashMap<String, Object>();
2
data.put("global.privacy", "optedout");
3
MobileCore.updateConfiguration(data);
Copied!

Swift

Syntax
1
@objc(updateConfiguration:)
2
static func updateConfigurationWith(configDict: [String: Any])
Copied!
Example
1
let updatedConfig = ["global.privacy":"optedout"]
2
MobileCore.updateConfigurationWith(configDict: updatedConfig)
Copied!

Objective-C

Syntax
1
+ (void) updateConfiguration: (NSDictionary* __nullable) config;
Copied!
Example
1
NSDictionary *updatedConfig = @{@"global.privacy":@"optedout"};
2
[AEPMobileCore updateConfiguration:updatedConfig];
Copied!

Swift

Syntax
1
static func updateConfiguration(_: [String: Any])
Copied!
Example
1
let updatedConfig = ["global.privacy":"optedout"]
2
ACPCore.updateConfiguration(updatedConfig)
Copied!

Objective-C

Syntax
1
+ (void) updateConfiguration: (NSDictionary* __nullable) config;
Copied!
Example
1
NSDictionary *updatedConfig = @{@"global.privacy":@"optedout"};
2
[ACPCore updateConfiguration:updatedConfig];
Copied!

JavaScript

Syntax
1
updateConfiguration(configMap?: { string: any })
Copied!
Example
1
ACPCore.updateConfiguration({"global.privacy":"optedout"});
Copied!

Dart

Syntax
1
static Future<void> updateConfiguration(Map<String, Object> configMap);
Copied!
Example
1
FlutterACPCore.updateConfiguration({"global.privacy":"optedout"});
Copied!

Cordova

1
ACPCore.updateConfiguration({"global.privacy":"optedout"}, function(handleCallback) {
2
console.log("AdobeExperenceSDK: Update configuration successful: " + handleCallback);
3
}, function(handleError) {
4
console.log("AdobeExperenceSDK: Failed to update configuration : " + handleError);
5
});
Copied!

C#

Syntax
1
public static void UpdateConfiguration(Dictionary<string, object> config);
Copied!
Example
1
var dict = new Dictionary<string, object>();
2
dict.Add("global.privacy", "optedout");
3
ACPCore.UpdateConfiguration(dict);
Copied!

C#

Syntax
1
void UpdateConfiguration([NullAllowed] NSDictionary config);
Copied!
iOS Example
1
var config = new NSMutableDictionary<NSString, NSObject>
2
{
3
["global.privacy"] = new NSString("optedout")
4
};
5
ACPCore.UpdateConfiguration(config);
Copied!
Android Example
1
var config = new Dictionary<string, Java.Lang.Object>();
2
config.Add("global.privacy", "optedout");
3
ACPCore.UpdateConfiguration(config);
Copied!

Clearing programmatic updates to the configuration

This API is only available in Android and iOS (AEP 3.x).
You can clear any programmatic updates made to the configuration via the clearUpdatedConfiguration API. This will clear programmatic updates to configuration made via the updateConfiguration(configMap)(Android)/ updateConfigurationWith(configDict:)(iOS) API. It will also clear any updates to the MobilePrivacyStatus(Android)/ PrivacyStatus(iOS) made via setPrivacyStatus(privacyStatus)(Android)/ setPrivacyStatus(_ status:)(iOS).
For implementation details, please refer to Configuration API reference.

Using a bundled file configuration

You can include a bundled JSON configuration file in your app package to replace or complement the configuration that was downloaded by using the Configure with App ID per environment approach.
To download the JSON configuration file, use the following URL:
https://assets.adobedtm.com/PASTE-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 Experience 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 Experience 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:
Android
iOS (AEP 3.x)
iOS (ACP 2.x)
Xamarin

Java

1
// Case 1: to use ADBMobileConfig.json in the assets folder
2
// No code is needed
3
4
// Case 2: to use a config json from a absolute path:
5
MobileCore.configureWithFileInPath("absolute/path/to/exampleJSONfile.json");
6
7
// Case 3: to use a config json in Assets folder
8
MobileCore.configureWithFileInAssets("exampleJSONfile.json");
Copied!

Swift

Syntax
1
static func configureWith(filePath: String)
Copied!
Example
1
let filePath = Bundle.main.path(forResource: "ExampleJSONFile", ofType: "json")
2
if let filePath = filePath {
3
MobileCore.configureWith(filePath: filePath)
4
}
Copied!

Objective-C

Syntax
1
+ (void) configureWithFilePath: (NSString* __nullable) filepath;
Copied!
Example
1
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"ExampleJSONFile" ofType:@"json"];
2
[AEPMobileCore configureWithFilePath: filePath];
Copied!

Swift

Syntax
1
static func configureWithFile(inPath: String)
Copied!
Example
1
let filePath = Bundle.main.path(forResource: "ExampleJSONFile", ofType: "json")
2
ACPCore.configureWithFile(inPath: filePath)
Copied!

Objective-C

Syntax
1
+ (void) configureWithFileInPath: (NSString* __nullable) filepath;
Copied!
Example
1
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"ExampleJSONFile"ofType:@"json"];
2
[ACPCore configureWithFileInPath:filePath];
Copied!

C#

Syntax
1
void ConfigureWithFileInPath([NullAllowed] string filepath);
Copied!
Example
1
ACPCore.ConfigureWithFileInPath("absolute/path/to/exampleJSONfile.json");
Copied!

Environment-aware configuration properties

This feature is only available in iOS ACPCore version 2.0.3 or later, and iOS AEPCore version 3.0.0 and above.
Some extension developers might use different configuration values based on their environment, and the generated configuration might have several entries for the same property. For example, the Adobe Campaign Standard extension has different endpoints for development, staging, and production servers. Here is an example of a raw configuration that supports multiple build environments:

JavaScript

1
{
2
"myExtension.server": "mydomain.com",
3
"__dev__myExtension.server": "mydomain.dev.com",
4
"__stage__myExtension.server": "mydomain.stage.com"
5
}
Copied!
Each time a remote configuration is generated in the Data Collection UI, a build.environment value is set. This value is based on the environment that you are publishing. When the remote configuration is downloaded, the Configuration extension considers the value in build.environment and provides only the non-prefixed version for the current environment in the shared state.
Here is a modification of the previous example, which now includes build.environment:
1
{
2
"build.environment": "dev",
3
"myExtension.server": "mydomain.com",
4
"__dev__myExtension.server": "mydomain.dev.com",
5
"__stage__myExtension.server": "mydomain.stage.com"
6
}
Copied!
Here is the resulting shared state from the Configuration extension:
1
{
2
"build.environment": "dev",
3
"myExtension.server": "mydomain.dev.com"
4
}
Copied!

Sample configuration

Here's a sample JSON file for the SDK:
1
{
2
"experienceCloud.org": "[email protected]",
3
"target.clientCode": "yourclientcode",
4
"target.timeout": 5,
5
"audience.server": "omniture.demdex.net",
6
"audience.timeout": 5,
7
"analytics.rsids": "mobilersidsample",
8
"analytics.server": "obumobile1.sc.omtrdc.net",
9
"analytics.aamForwardingEnabled": false,
10
"analytics.offlineEnabled": true,
11
"analytics.batchLimit": 0,
12
"analytics.backdatePreviousSessionInfo": false,
13
"global.privacy": "optedin",
14
"lifecycle.sessionTimeout": 300,
15
"rules.url": "https://link.to.rules/test.zip"
16
}
Copied!