Skip to main content

Android

Last updated 10/03/2026
tip

The Android SDK requires Android 4.0 (API 14) or later.

Latest version: v1.3.0

Update time: 2026-07-22

Downloads: Download

1. Overview​

Starting from AE 4.4, the Engage module provides the Config Center feature, which lets you add feature parameter configurations in the AE backend and pull them to your app through the client SDK, so you can finely customize your interactions with players.

This article describes how to integrate the client SDK. On the app side, you only need to handle interactions with the ThinkingData SDK and don't need to care about configuration details in the AE backend.

2. Integration​

2.1 Integrate the SDK automatically​

  1. Add the following dependency configuration to the build.gradle file at the Project level
buildscript {
repositories {
jcenter()
mavenCentral()
}
}
  1. Add the dependency to the build.gradle file in the module directory:
dependencies {
implementation 'cn.thinkingdata.android:TDRemoteConfig:1.3.0'
}

2.2 Integrate the SDK manually​

Config Center depends on the following ThinkingData SDKs:

SDK nameDescriptionVersion requirement
TDAnalyticsCollects and processes data>= 3.1.0
TDRemoteConfigFetches configuration from the AE backend>= 1.0.0
TDCoreProvides basic components>= 1.1.0

1. Click the download link at the top of this page to download the SDK, and then unzip it

2. Add TDAnalytics.aar, TDCore.aar, and TDRemoteConfig.aar to the libs folder

3. Add the following configuration to build.gradle

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])
}

3. Initialization​

Initialize the SDK on the main thread

import cn.thinkingdata.remoteconfig.TDRemoteConfig;
import cn.thinkingdata.core.TDApp;
import cn.thinkingdata.core.TDSettings;
// For details on how to configure TDSettings, see [Advanced guide]
TDSettings settings = new TDSettings();
settings.appId = "AppId";
settings.serverUrl = "ServerUrl";
TDApp.init(context,settings);

4. Usage​

4.1 Sample data structure​

"configId" : {
"templateId" : [
{
"#strategy_id" : "2024121001",
"paramater_x" : "1111",
"#ops_receipt_properties" : {}
}
],
"#custom_params" : {

}
}

Where:

configId: The Config ID created in the Config Center module of the Engage backend, used to identify the business module. For details about config items, see Config items

templateId: The Template ID that you add under Config Items, used to identify the specific feature module. For details about config templates, see Config templates

#strategy_id: The unique ID of the strategy, used for strategy lifecycle management. For details about config strategies, see Config strategies

paramater_x: A config template parameter, corresponding to a configuration parameter required by the feature module

#ops_receipt_properties: Used for event receipt statistics. When you need to automatically measure strategy effects (not supported yet), receipt events must carry this property

#custom_params: Custom parameters on the client config channel. You can define the user property information to be carried to the client.

4.2 Set local default values​

You can set default values for config items in the TDRemoteConfig SDK. When a config item hasn't been added on the AE server, or the remote value hasn't been fetched locally, the SDK gets the local default value.

Format​

Local default values must use the following format:

{
"configId": {
"templateId": [
{
"paramater_x" : ""
}
]
}
}

Set directly​

try {
JSONObject params = new JSONObject();
JSONObject configIdJson = new JSONObject();
JSONObject templateIdJson = new JSONObject();
templateIdJson.put("paramater_x","");
configIdJson.put("templateId",templateIdJson);
params.put("configId",configIdJson);
TDRemoteConfig.setDefaultValues(params);
} catch (JSONException e) {
e.printStackTrace();
}

Set from a local file​

val filePath = "";//File path
TDRemoteConfig.setDefaultValues(filePath)

Clear default values​

TDRemoteConfig.clearDefaultValues()

4.3 Get values​

Get the content of the released and online strategies of a certain type under a config item:

JSONArray array = TDRemoteConfig.getData().get("configId").get("templateId").arrayValue();

Where:

configId: The Config ID created in the Config Center module of the Engage backend, used to identify the business module. For details about config items, see Config items

templateId: The Template ID that you add under Config Items, used to identify the specific feature module. For details about config templates, see Config templates

Value resolution rules​

How the value of a key is resolved:

  • The remote config value for the key is used first
  • If the key isn't configured remotely, the local default value for the key is used
  • If the local default values don't contain the key either, an empty value is returned.

4.4 Listen for updates​

Before you initialize the SDK, add a notification listener for successful config fetches

TDRemoteConfig.addConfigFetchListener(new TDRemoteConfig.OnConfigFetchListener() {
@Override
public void onFetchSuccess(JSONObject statusData) {

}
});

Notification name​

onFetchSuccess (config fetched successfully)

Parameters carried by the notification​

tip

By default, the notification carries the statuses of strategies that changed to suspended (suspend) or forced offline (force_offline) between the previous request and this request. You can use them as your business requires. If you don't need them, ignore them.

Get the notification parameters as follows

JSONObject map = statusData.optJSONObject("strategy_status_map");

The corresponding value structure is as follows. It describes the status of the strategy whose ID is 20241209 in the config item template.

{
"configId" : {
"templateId" : {
"20241209" : "suspend"
}
}
}

5. Send Test​

To quickly verify that the integration works and that config strategies are valid, the SDK supports a test mode.

TDSettings settings = new TDSettings();
settings.mode = TDSettings.TDMode.DEBUG;
settings.appId = "AppId";
settings.serverUrl = "ServerUrl";
TDApp.init(context,settings);

After you enable debug mode on the client, the client fetches test strategies every 5s. In the AE Engage module, you can create template tests or strategy tests. While waiting for the configuration to be fetched, you can watch the progress nodes on the frontend page.

For details, see the client Send Test section in Config templates.

Send tests for the client SDK require test devices. You can select or add test devices in the test device list.

Was this page helpful?