Configuration API reference

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
Unity
Xamarin
Android

Syntax

public static void configureWithAppID(final String appId);

Example

Java

MobileCore.configureWithAppId("1423ae38-8385-8963-8693-28375403491d");
iOS

Syntax

+ (void) configureWithAppId: (NSString* __nullable) appid;

Example

Objective-C

[ACPCore configureWithAppId:@"1423ae38-8385-8963-8693-28375403491d"];

Swift

ACPCore.configure(withAppId: "1423ae38-8385-8963-8693-28375403491d")
Unity

Syntax

public static void ConfigureWithAppID(string appId)

Example

C#

ACPCore.ConfigureWithAppID("1423ae38-8385-8963-8693-28375403491d");
Xamarin

Android Syntax

public unsafe static void ConfigureWithAppID (string appId);

iOS Syntax

public static void ConfigureWithAppID (string appid);

Example

C#

ACPCore.ConfigureWithAppID("1423ae38-8385-8963-8693-28375403491d");

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
React Native
Flutter
Cordova
Unity
Xamarin
Android

updateConfiguration

Syntax

public static void updateConfiguration(final Map configMap);

Example

Java

HashMap<String, Object> data = new HashMap<String, Object>();
data.put("global.privacy", "optedout");
MobileCore.updateConfiguration(data);
iOS

updateConfiguration

Syntax

+ (void) updateConfiguration: (NSDictionary* __nullable) config;

Example

Objective-C

NSDictionary *updatedConfig = @{@"global.privacy":@"optedout"};
[ACPCore updateConfiguration:updatedConfig];

Swift

let updatedConfig = ["global.privacy":"optedout"]
ACPCore.updateConfiguration(updatedConfig)
React Native

JavaScript

updateConfiguration

ACPCore.updateConfiguration({"global.privacy":"optedout"});
Flutter

Dart

updateConfiguration

FlutterACPCore.updateConfiguration({"global.privacy":"optedout"});
Cordova

Javascript

Update SDK configuration

ACPCore.updateConfiguration({"newConfigKey":"newConfigValue"}, successCallback, errorCallback);
Unity

C#

Update SDK configuration

var dict = new Dictionary<string, object>();
dict.Add("newConfigKey", "newConfigValue");
ACPCore.UpdateConfiguration(dict);
Xamarin

C#

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);

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 Launch App ID approach.

To pass in a bundled path and file name:

Android
iOS
Xamarin
Android

Syntax

public static void configureWithFileInPath(final String filePath);

Example

Java

MobileCore.configureWithFileInPath("absolute/path/to/exampleJSONfile.json");
iOS

Syntax

+ (void) configureWithFileInPath: (NSString* __nullable) filepath;

Example

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)
Xamarin

Android Syntax

public unsafe static void ConfigureWithFileInPath (string filepath);

iOS Syntax

public static void ConfigureWithFileInPath (string filepath);

Example

C#

ACPCore.ConfigureWithFileInPath("absolute/path/to/exampleJSONfile.json");