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)" %} Swift
let version = MobileCore.extensionVersionObjective C
NSString *version = [AEPMobileCore extensionVersion];{% endtab %}
{% tab title="iOS (ACP 2.x)" %} Objective C
NSString *coreExtensionVersion = [ACPCore extensionVersion];Swift
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 %}
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" %}
public static void configureWithAppID(final String appId);MobileCore.configureWithAppId("1423ae38-8385-8963-8693-28375403491d");{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
static func configureWith(appId: String) [AEPMobileCore configureWithAppId: @"1423ae38-8385-8963-8693-28375403491d"]; MobileCore.configureWith(appId: "1423ae38-8385-8963-8693-28375403491d"){% endtab %}
{% tab title="iOS (ACP 2.x)" %}
+ (void) configureWithAppId: (NSString* __nullable) appid;[ACPCore configureWithAppId:@"1423ae38-8385-8963-8693-28375403491d"];ACPCore.configure(withAppId: "1423ae38-8385-8963-8693-28375403491d"){% endtab %}
{% tab title="Unity" %}
public static void ConfigureWithAppID(string appId)ACPCore.ConfigureWithAppID("1423ae38-8385-8963-8693-28375403491d");{% endtab %}
{% tab title="Xamarin" %}
public unsafe static void ConfigureWithAppID (string appId);public static void ConfigureWithAppID (string appid);ACPCore.ConfigureWithAppID("1423ae38-8385-8963-8693-28375403491d");
{% 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" %}
public static void updateConfiguration(final Map configMap);HashMap<String, Object> data = new HashMap<String, Object>();
data.put("global.privacy", "optedout");
MobileCore.updateConfiguration(data);{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
@objc(updateConfiguration:)
static func updateConfigurationWith(configDict: [String: Any]) let updatedConfig = ["global.privacy":"optedout"]
MobileCore.updateConfigurationWith(configDict: updatedConfig) NSDictionary *updatedConfig = @{@"global.privacy":@"optedout"};
[AEPMobileCore updateConfiguration:updatedConfig];{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
+ (void) updateConfiguration: (NSDictionary* __nullable) config;NSDictionary *updatedConfig = @{@"global.privacy":@"optedout"};
[ACPCore updateConfiguration:updatedConfig];let updatedConfig = ["global.privacy":"optedout"]
ACPCore.updateConfiguration(updatedConfig){% endtab %}
{% tab title="React Native" %}
ACPCore.updateConfiguration({"global.privacy":"optedout"});{% endtab %}
{% tab title="Flutter" %}
FlutterACPCore.updateConfiguration({"global.privacy":"optedout"});{% endtab %}
{% tab title="Cordova" %}
Update SDK configuration
ACPCore.updateConfiguration({"newConfigKey":"newConfigValue"}, successCallback, errorCallback);{% endtab %}
{% tab title="Unity" %}
Update SDK configuration
var dict = new Dictionary<string, object>();
dict.Add("newConfigKey", "newConfigValue");
ACPCore.UpdateConfiguration(dict);{% endtab %}
{% tab title="Xamarin" %}
Update SDK configuration
iOS
var config = new NSMutableDictionary<NSString, NSObject>
{
["newConfigKey"] = new NSString("newConfigValue")
};
ACPCore.UpdateConfiguration(config);Android
var config = new Dictionary<string, Java.Lang.Object>();
config.Add("newConfigKey", "newConfigValue");
ACPCore.UpdateConfiguration(config);{% 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 Launch App ID approach.
To pass in a bundled path and file name:
{% tabs %} {% tab title="Android" %}
public static void configureWithFileInPath(final String filePath);MobileCore.configureWithFileInPath("absolute/path/to/exampleJSONfile.json");{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
static func configureWith(filePath: String)Objective-C
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"ExampleJSONFile" ofType:@"json"];
[AEPMobileCore configureWithFilePath:filePath];Swift
let filePath = Bundle.main.path(forResource: "ExampleJSONFile", ofType: "json")
MobileCore.configureWith(filePath: filePath){% endtab %}
{% tab title="iOS (ACP 2.x)" %}
+ (void) configureWithFileInPath: (NSString* __nullable) filepath;Objective-C
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"ExampleJSONFile"ofType:@"json"];
[ACPCore configureWithFileInPath:filePath];Swift
let filePath = Bundle.main.path(forResource: "ExampleJSONFile", ofType: "json")
ACPCore.configureWithFile(inPath: filePath){% endtab %}
{% tab title="Xamarin" %}
public unsafe static void ConfigureWithFileInPath (string filepath);public static void ConfigureWithFileInPath (string filepath);ACPCore.ConfigureWithFileInPath("absolute/path/to/exampleJSONfile.json");{% endtab %} {% endtabs %}
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 Launch App ID approach.
{% hint style="info" %}
Method configureWithFileInAssets was added in Android Core version 1.7.0.
{% endhint %}
{% tabs %} {% tab title="Android" %}
public static void configureWithFileInAssets(final String fileName);MobileCore.configureWithFileInAssets("exampleJSONfile.json");{% endtab %} {% endtabs %}