Skip to content

Latest commit

 

History

History
75 lines (41 loc) · 5.75 KB

configuration-extension.md

File metadata and controls

75 lines (41 loc) · 5.75 KB
description
This information can help you configure the Mobile Services SDK.

Configuration Extension

The Adobe Cloud Platform SDKs retrieves the configuration in the following ways:

  • Using the app ID - A unique app ID that is generated in the Adobe Launch and that can be used to retrieve the remote configuration file, which is hosted on the Adobe servers.

  • Using a bundled file - The JSON file that is downloaded from Adobe Launch

    can be bundled in your application.

  • Updating the configuration - Using the updateConfiguration public API, you can programmatically update or add new key /value pairs.

Using the app ID

Important: We recommend that you use the app ID to set your configuration.

The Adobe Cloud Platform SDKs configuration can be set by downloading a remote JSON file that is referenced with a unique app ID. This ID is generated by Adobe Launch when an app configuration is created. After providing the app ID, the Adobe Cloud Platform SDKs retrieves the configuration for each module that is hosted by Adobe Servers.

Tip: After being downloaded, the configuration file is locally cached.

Subsequent requests to this API will use the cached file unless an updated version is detected on the network. The app ID that is passed to this API is stored, so that when the app is launched again, the Adobe Cloud Platform SDKs configuration is preserved. If a network error occurs while downloading the configuration file, the local cache file is used as the new configuration.

No configuration changes are made in the following scenarios:

  • If there is no cache file.
  • If the file download fails.
  • If a file-read error or parsing error occurs.

Tip: Before applying the new configuration to the SDK, programmatic updates that were made by using the UpdateConfiguration method are applied over the remote file's configuration.

The unique app ID is set to the Adobe Cloud Platform SDKs in one of the following ways:

iOS

  • ConfigureWithAppId method

    For more information about the ConfigureWithAppId method, see the ConfigureWithAppId row in Configuration Methods in iOS.

  • Placing the app ID in the Info.plist file Add the AppID from Adobe Launch in your application’s Info.plist file.

    The app ID is added with the ADBMobileAppID key name. When the Adobe Experience Cloud Platform SDKs is started, the app ID property is automatically read in the Info.plist file, and the Adobe Cloud Platform SDKs attempts to retrieve the corresponding remote configuration.

Android

Required: The setApplication method must be called once in the onCreate method of your main activity.

For more information about the setApplication method, see Configuration Methods in Android.

After the setApplication method is called, select one of the following options:

  • ConfigureWithAppId For more information about the ConfigureWithAppId method in Android, see the ConfigureWithAppId row in Configuration Methods in Android.
  • Placing the app ID in the Manifest file. Add the app ID from Adobe Launch in your applications manifest file. The app ID is added with the ADBMobileAppID key name. After the Adobe Cloud Platform SDKs is started, the app ID property in the manifest file is automatically read, and the Adobe Cloud Platform SDKs attempts to retrieve the corresponding remote configuration.

Using a bundled file

The Adobe Cloud Platform SDKs configuration can be set by loading a local file that is bundled with the application:

  • In iOS, the ADBMobileConfig.json file can be placed anywhere that it is accessible in your bundle.
  • In Android, the ADBMobileConfig.json file must be placed in the assets folder.

You can also load a different ADBMobileConfig.json file by using the ConfigureWithFileInPath method. The Adobe Cloud 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 Cloud Platform SDKs. If a file-read error or JSON parsing error occurs, no configuration changes are made.

For more information about the ConfigureWithFileInPath method, see Configuration Methods in Android and Configuration Methods in iOS.

Updating the configuration

The Adobe Cloud Platform SDKs configuration can be updated programmatically by using the UpdateConfiguration method. This method takes in a list of key-value pairs that update the value of an existing configuration. If the key is not found in the current configuration, the method adds the new key-value pair.UpdateConfiguration only updates or adds the specific keys in the list. The method does not replace or clear values that are not in the list of key-value pairs that were passed to the API, which means that the multiple calls to UpdateConfiguration are cumulative. Passing null values for existing keys will clear the previous value set from UpdateConfiguration for that key.

The key-value pairs that are passed to UpdateConfiguration are persisted and will overwrite future configuration changes that are made by using ConfigureWithAppId or ConfigureWithFileInPath.

For more information about the updateConfiguration method, see the updateConfiguration row in Configuration Methods in Android and Configuration Methods in iOS.