{% hint style="info" %} This API is only available in Android and iOS (AEP 3.x). {% endhint %}
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 viaconfigureWithAppId(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 viaconfigureWithFileInPath(filePath)
(Android)/configureWith(filePath:)
(iOS) -
configureWithFileInAssets(fileName)
(Android) ->updateConfiguration(configMap)
(Android) ->clearUpdatedConfiguration()
: In this example, you end up with the initial configuration set viaconfigureWithFileInAssets(fileName)
(Android) -
configureWithAppId(appId)
(Android)/configureWith(appId:)
(iOS) orconfigureWithFileInPath(filePath)
(Android)/configureWith(filePath:)
(iOS) orconfigureWithFileInAssets(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) orconfigureWithFileInPath(filePath)
(Android)/configureWith(filePath:)
(iOS) orconfigureWithFileInAssets(fileName)
(Android) ->setPrivacyStatus(privacyStatus)
(Android)/setPrivacyStatus(_ status:)
(iOS) ->clearUpdatedConfiguration()
: In this example, the configuration will have the initialMobilePrivacyStatus
(Android)/PrivacyStatus
(iOS) set viaconfigureWithAppId(appId)
(Android)/configureWith(appId:)
(iOS) orconfigureWithFileInPath(filePath)
(Android)/configureWith(filePath:)
(iOS) orconfigureWithFileInAssets(fileName)
(Android).
{% tabs %} {% tab title="Android" %}
Syntax
public static void clearUpdatedConfiguration();
Example
MobileCore.clearUpdatedConfiguration();
{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
Syntax
static func clearUpdatedConfiguration()
Example
MobileCore.clearUpdatedConfiguration()
Syntax
+ (void) clearUpdatedConfiguration();
Example
[AEPMobileCore clearUpdatedConfiguration];
{% endtab %} {% endtabs %}
This API causes the SDK to download the configuration for the provided app ID and apply the configuration to the current session.
{% tabs %} {% tab title="Android" %}
Syntax
public static void configureWithAppID(final String appId);
Example
MobileCore.configureWithAppId("1423ae38-8385-8963-8693-28375403491d");
{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
Syntax
static func configureWith(appId: String)
Example
MobileCore.configureWith(appId: "1423ae38-8385-8963-8693-28375403491d")
Syntax
+ (void) configureWithAppId: (NSString* appId);
Example
[AEPMobileCore configureWithAppId: @"1423ae38-8385-8963-8693-28375403491d"];
{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
Syntax
static func configure(withAppId: String)
Example
ACPCore.configure(withAppId: "1423ae38-8385-8963-8693-28375403491d")
Syntax
+ (void) configureWithAppId: (NSString* __nullable) appid;
Example
[ACPCore configureWithAppId:@"1423ae38-8385-8963-8693-28375403491d"];
{% endtab %}
{% tab title="Unity" %}
Syntax
public static void ConfigureWithAppID(string appId)
Example
ACPCore.ConfigureWithAppID("1423ae38-8385-8963-8693-28375403491d");
{% endtab %}
{% tab title="Xamarin" %}
Android Syntax
public unsafe static void ConfigureWithAppID (string appId);
iOS Syntax
public static void ConfigureWithAppID (string appid);
Example
ACPCore.ConfigureWithAppID("1423ae38-8385-8963-8693-28375403491d");
{% endtab %} {% endtabs %}
{% hint style="info" %} This API is only available in Android and was added in Android was added in Android Core version 1.7.0. {% endhint %}
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.
{% tabs %} {% tab title="Android" %}
Syntax
public static void configureWithFileInAssets(final String fileName);
Example
MobileCore.configureWithFileInAssets("exampleJSONfile.json");
{% endtab %} {% endtabs %}
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:
{% tabs %} {% tab title="Android" %}
Syntax
public static void configureWithFileInPath(final String filePath);
Example
MobileCore.configureWithFileInPath("absolute/path/to/exampleJSONfile.json");
{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
Syntax
static func configureWith(filePath: String)
Example
let filePath = Bundle.main.path(forResource: "ExampleJSONFile", ofType: "json")
MobileCore.configureWith(filePath: filePath)
Syntax
+ (void) configureWithFileInPath: (NSString* __nullable) filepath;
Example
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"ExampleJSONFile" ofType:@"json"];
[AEPMobileCore configureWithFilePath:filePath];
{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
Syntax
static func configureWithFile(inPath: String)
Example
let filePath = Bundle.main.path(forResource: "ExampleJSONFile", ofType: "json")
ACPCore.configureWithFile(inPath: filePath)
Syntax
+ (void) configureWithFileInPath: (NSString* __nullable) filepath;
Example
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"ExampleJSONFile"ofType:@"json"];
[ACPCore configureWithFileInPath:filePath];
{% endtab %}
{% tab title="Xamarin" %}
Android Syntax
public unsafe static void ConfigureWithFileInPath (string filepath);
iOS Syntax
public static void ConfigureWithFileInPath (string filepath);
Example
ACPCore.ConfigureWithFileInPath("absolute/path/to/exampleJSONfile.json");
{% endtab %} {% endtabs %}
The extensionVersion()
API returns the version of the Configuration extension.
To get the version of the Configuration extension, use the following code sample:
{% tabs %} {% tab title="Android" %}
String coreExtensionVersion = MobileCore.extensionVersion();
{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
let version = MobileCore.extensionVersion
NSString *version = [AEPMobileCore extensionVersion];
{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
NSString *coreExtensionVersion = [ACPCore extensionVersion];
let coreExtensionVersion = ACPCore.extensionVersion()
{% endtab %}
{% tab title="React Native" %}
ACPCore.extensionVersion().then(coreExtensionVersion => console.log("AdobeExperienceSDK: ACPCore version: " + coreExtensionVersion));
{% endtab %}
{% tab title="Flutter" %}
String coreExtensionVersion = await FlutterACPCore.extensionVersion;
{% endtab %}
{% tab title="Cordova" %}
ACPCore.extensionVersion(function(version) {
console.log("ACPCore version: " + version);
}, function(error) {
console.log(error);
});
{% endtab %}
{% tab title="Unity" %}
string coreExtensionVersion = ACPCore.ExtensionVersion();
{% endtab %}
{% tab title="Xamarin" %}
string coreExtensionVersion = ACPCore.ExtensionVersion();
{% endtab %} {% endtabs %}
You can also update the configuration programmatically by passing configuration keys and values to override the existing configuration.
{% hint style="info" %} 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. {% endhint %}
{% hint style="warning" %}
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.
{% endhint %}
{% tabs %} {% tab title="Android" %}
Syntax
public static void updateConfiguration(final Map configMap);
Example
HashMap<String, Object> data = new HashMap<String, Object>();
data.put("global.privacy", "optedout");
MobileCore.updateConfiguration(data);
{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
Syntax
@objc(updateConfiguration:)
static func updateConfigurationWith(configDict: [String: Any])
Example
let updatedConfig = ["global.privacy":"optedout"]
MobileCore.updateConfigurationWith(configDict: updatedConfig)
Syntax
+ (void) updateConfiguration: (NSDictionary* __nullable) config;
Example
NSDictionary *updatedConfig = @{@"global.privacy":@"optedout"};
[AEPMobileCore updateConfiguration:updatedConfig];
{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
Syntax
static func updateConfiguration(_: [String: Any])
Example
let updatedConfig = ["global.privacy":"optedout"]
ACPCore.updateConfiguration(updatedConfig)
Syntax
+ (void) updateConfiguration: (NSDictionary* __nullable) config;
Example
NSDictionary *updatedConfig = @{@"global.privacy":@"optedout"};
[ACPCore updateConfiguration:updatedConfig];
{% endtab %}
{% tab title="React Native" %}
Syntax
updateConfiguration(configMap?: { string: any })
Example
ACPCore.updateConfiguration({"global.privacy":"optedout"});
{% endtab %}
{% tab title="Flutter" %}
Syntax
static Future<void> updateConfiguration(Map<String, Object> configMap);
Example
FlutterACPCore.updateConfiguration({"global.privacy":"optedout"});
{% endtab %}
{% tab title="Cordova" %}
ACPCore.updateConfiguration({"newConfigKey":"newConfigValue"}, successCallback, errorCallback);
{% endtab %}
{% tab title="Unity" %}
Syntax
public static void UpdateConfiguration(Dictionary<string, object> config);
Example
var dict = new Dictionary<string, object>();
dict.Add("newConfigKey", "newConfigValue");
ACPCore.UpdateConfiguration(dict);
{% endtab %}
{% tab title="Xamarin" %}
Syntax
void UpdateConfiguration([NullAllowed] NSDictionary config);
iOS Example
var config = new NSMutableDictionary<NSString, NSObject>
{
["newConfigKey"] = new NSString("newConfigValue")
};
ACPCore.UpdateConfiguration(config);
Android Example
var config = new Dictionary<string, Java.Lang.Object>();
config.Add("newConfigKey", "newConfigValue");
ACPCore.UpdateConfiguration(config);
{% endtab %} {% endtabs %}