Configuration API reference

clearUpdatedConfiguration

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).
Here are some examples of scenarios:
  • configureWithAppId(appId)(Android)/configureWith(appId:)(iOS) -> updateConfiguration(configMap)(Android)/ updateConfigurationWith(configDict:)(iOS) -> clearUpdatedConfiguration(): In this example, you end up with the initial configuration set via configureWithAppId(appId)(Android)/ configureWith(appId:)(iOS)
  • configureWithFileInPath(filePath)(Android)/ configureWith(filePath:)(iOS) -> updateConfiguration(configMap)(Android)/ updateConfigurationWith(configDict)(iOS) -> clearUpdatedConfiguration(): In this example, you end up with the initial configuration set via configureWithFileInPath(filePath)(Android)/ configureWith(filePath:)(iOS)
  • configureWithFileInAssets(fileName)(Android) -> updateConfiguration(configMap)(Android) -> clearUpdatedConfiguration(): In this example, you end up with the initial configuration set via configureWithFileInAssets(fileName)(Android)
  • configureWithAppId(appId)(Android)/configureWith(appId:)(iOS) or configureWithFileInPath(filePath)(Android)/ configureWith(filePath:)(iOS) or configureWithFileInAssets(fileName)(Android) -> updateConfiguration(configMap)(Android)/ updateConfigurationWith(configDict)(iOS) -> clearUpdatedConfiguration() -> updateConfiguration(configMap)(Android)/ updateConfigurationWith(configDict)(iOS): In this example, the configuration will be the most recently updated configuration and will not have any keys from the first update unless they are included in the most recent update.
  • configureWithAppId(appId)(Android)/configureWith(appId:)(iOS) or configureWithFileInPath(filePath)(Android)/ configureWith(filePath:)(iOS) or configureWithFileInAssets(fileName)(Android) -> setPrivacyStatus(privacyStatus)(Android)/ setPrivacyStatus(_ status:)(iOS) -> clearUpdatedConfiguration(): In this example, the configuration will have the initial MobilePrivacyStatus(Android)/ PrivacyStatus(iOS) set via configureWithAppId(appId)(Android)/configureWith(appId:)(iOS) or configureWithFileInPath(filePath)(Android)/ configureWith(filePath:)(iOS) or configureWithFileInAssets(fileName)(Android).
Android
iOS (AEP 3.x)

Java

Syntax
1
public static void clearUpdatedConfiguration();
Copied!
Example
1
MobileCore.clearUpdatedConfiguration();
Copied!

Swift

Syntax
1
static func clearUpdatedConfiguration()
Copied!
Example
1
MobileCore.clearUpdatedConfiguration()
Copied!

Objective-C

Syntax
1
+ (void) clearUpdatedConfiguration();
Copied!
Example
1
[AEPMobileCore clearUpdatedConfiguration];
Copied!

configureWithAppID

This API causes the SDK to download the configuration for the provided app ID and apply the configuration to the current session.
Android
iOS (AEP 3.x)
iOS (ACP 2.x)
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!

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!

C#

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

C#

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

configureWithFileInAssets

This API is only available in Android and was added in Android was added in Android Core version 1.7.0.
You can bundle a JSON configuration file in the app's Assets folder to replace or complement the configuration that was downloaded by using the Configure with App ID per environment approach.
Android

Java

Syntax
1
public static void configureWithFileInAssets(final String fileName);
Copied!
Example
1
MobileCore.configureWithFileInAssets("exampleJSONfile.json");
Copied!

configureWithFileInPath

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 pass in a bundled path and file name:
Android
iOS (AEP 3.x)
iOS (ACP 2.x)
Xamarin

Java

Syntax
1
public static void configureWithFileInPath(final String filePath);
Copied!
Example
1
MobileCore.configureWithFileInPath("absolute/path/to/exampleJSONfile.json");
Copied!

Swift

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

Objective-C

Syntax
1
+ (void) configureWithFileInPath: (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#

Android Syntax
1
public unsafe static void ConfigureWithFileInPath (string filepath);
Copied!
iOS Syntax
1
public static void ConfigureWithFileInPath (string filepath);
Copied!
Example
1
ACPCore.ConfigureWithFileInPath("absolute/path/to/exampleJSONfile.json");
Copied!

extensionVersion

The extensionVersion() API returns the version of the Configuration extension.
To get the version of the Configuration extension, use the following code sample:
Android
iOS (AEP 3.x)
iOS (ACP 2.x)
React Native
Flutter
Cordova
Unity
Xamarin
Java
1
String coreExtensionVersion = MobileCore.extensionVersion();
Copied!
Swift
1
let version = MobileCore.extensionVersion
Copied!
Objective C
1
NSString *version = [AEPMobileCore extensionVersion];
Copied!
Objective C
1
NSString *coreExtensionVersion = [ACPCore extensionVersion];
Copied!
Swift
1
let coreExtensionVersion = ACPCore.extensionVersion()
Copied!

JavaScript

1
ACPCore.extensionVersion().then(coreExtensionVersion => console.log("AdobeExperienceSDK: ACPCore version: " + coreExtensionVersion));
Copied!

Dart

1
String coreExtensionVersion = await FlutterACPCore.extensionVersion;
Copied!

Cordova

1
ACPCore.extensionVersion(function(version) {
2
console.log("ACPCore version: " + version);
3
}, function(error) {
4
console.log(error);
5
});
Copied!

C#

1
string coreExtensionVersion = ACPCore.ExtensionVersion();
Copied!

C#

1
string coreExtensionVersion = ACPCore.ExtensionVersion();
Copied!

updateConfiguration

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 key or any key with an environment prefix, because it can lead to unexpected behaviors. 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 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!

Javascript

1
ACPCore.updateConfiguration({"newConfigKey":"newConfigValue"}, successCallback, errorCallback);
Copied!

C#

Syntax
1
public static void UpdateConfiguration(Dictionary<string, object> config);
Copied!
Example
1
var dict = new Dictionary<string, object>();
2
dict.Add("newConfigKey", "newConfigValue");
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
["newConfigKey"] = new NSString("newConfigValue")
4
};
5
ACPCore.UpdateConfiguration(config);
Copied!
Android Example
1
var config = new Dictionary<string, Java.Lang.Object>();
2
config.Add("newConfigKey", "newConfigValue");
3
ACPCore.UpdateConfiguration(config);
Copied!