Edit in GitHubLog an issue

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.

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:

Java

Syntax

Copied to your clipboard
public static void configureWithAppID(@NonNull final String appId);

Example

Copied to your clipboard
MobileCore.configureWithAppId("1423ae38-8385-8963-8693-28375403491d");

Programmatic updates to configuration

You can also update the configuration programmatically by passing configuration keys and values to override the existing configuration.

Java

Syntax

Copied to your clipboard
public static void updateConfiguration(@NonNull final Map<String, Object> configMap);

Example

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

Clearing programmatic updates to the configuration

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

Applications which need to get data from the SDK early in the application lifecycle should use a bundled file configuration. This will allow the SDK to properly process events before a remote configuration is downloaded, using the bundled configuration in early, app launch scenarios. If you are going to use a bundled file configuration to help with early app processing, it is strongly recommended that you also use bundled rules.

To use a bundled configuration, follow the steps below:

  1. Download your JSON configuration file from the following URL: https://assets.adobedtm.com/PASTE-ENVIRONMENT-ID.json, replacing PASTE-ENVIRONMENT-ID with your mobile property environment ID.
  2. Rename the JSON file to “ADBMobileConfig.json”.
  3. iOS: Place the file anywhere that it is accessible in your app bundle. Android: Place the file 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:

Java

Syntax

Copied to your clipboard
public static void configureWithFileInPath(@NonNull final String filePath)

Example

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

Environment-aware configuration properties

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:

Copied to your clipboard
{
"myExtension.server": "mydomain.com",
"__dev__myExtension.server": "mydomain.dev.com",
"__stage__myExtension.server": "mydomain.stage.com"
}

Here is a modification of the previous example, which now includes build.environment:

Copied to your clipboard
{
"build.environment": "dev",
"myExtension.server": "mydomain.com",
"__dev__myExtension.server": "mydomain.dev.com",
"__stage__myExtension.server": "mydomain.stage.com"
}

Here is the resulting shared state from the Configuration extension:

Copied to your clipboard
{
"build.environment": "dev",
"myExtension.server": "mydomain.dev.com"
}

Sample configuration

Here's a sample JSON file for the SDK:

Copied to your clipboard
{
"experienceCloud.org": "3CE342C75100435B0A490D4C@AdobeOrg",
"target.clientCode": "yourclientcode",
"target.timeout": 5,
"audience.server": "omniture.demdex.net",
"audience.timeout": 5,
"analytics.rsids": "mobilersidsample",
"analytics.server": "obumobile1.sc.omtrdc.net",
"analytics.aamForwardingEnabled": false,
"analytics.offlineEnabled": true,
"analytics.batchLimit": 0,
"analytics.backdatePreviousSessionInfo": false,
"global.privacy": "optedin",
"lifecycle.sessionTimeout": 300,
"rules.url": "https://link.to.rules/test.zip"
}
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.