In order to reduce the trouble for developers to update app version frequently, SolarEngine introduces Remote Config (Online Parameter) feature. By delivering parameters, developers can update app content remotely at any time.
This document is applicable to:
Since the remote config SDK is a plugin of SolarEngine SDK, developers do not need to configure it separately when integrating. It is enabled by default. Developers can choose to cancel it on the setting panel.
Parameter | Parameter Meaning | Type | Required |
---|---|---|---|
iOS | Whether to use the remote config plugin on the iOS platform | bool | NO |
Android | Whether to use the remote config plugin on the Android platform | bool | NO |
MiniGame | Whether to use the remote config plugin on the MiniGame platform | bool | NO |
OpenHarmony | Whether to use the remote config plugin on the OpenHarmony platform | bool | NO |
Mac OS | Whether to use the remote config plugin on the MiniGame platform | bool | NO |
Since Remote Config SDK is a plugin of SolarEngine SDK, Remote Config SDK initialization depends on the SolarEngine SDK initialization.
Function
public static void initSeSdk(string appKey, SEConfig seConfig, RCConfig rcConfig)
Parameters
Parameter | Parameter Meaning | Type | Required |
---|---|---|---|
appKey | appkey obtained from SE dashboard | String | YES |
seConfig | SE SDK config | SEConfig | YES |
rcConfig | SE remote config SDK config | RCConfig | YES |
seConfig parameter description: please refer to the Unity SDK Access documentation.
rcConfig parameter description:
Parameter Name | Meaning | Type | Required |
---|---|---|---|
enable | Whether to enable the parameter delivery SDK (Default false) | bool | YES |
mergeType | Server and SDK merge type (For details, please refer to the explanation below) | RCMergeType | NO |
customIDProperties | Custom ID, matching the custom ID set by the user on the dashboard | Dictionary<string, object> | NO |
customIDEventProperties | Custom ID event property value, matching the event attribute value set by the user on the dashboard. | Dictionary<string, object> | NO |
customIDUserProperties | Custom ID user property value, matching the user attribute value set by the useron the dashboard. | Dictionary<string, object> | NO |
Introduction to mergeType (merge strategy):
Parameter | Parameter Meaning |
---|---|
ByUser | When the app is first launched or the version is updated, use the server configuration to merge with the user's default configuration. This method can clear the local cache configuration. |
ByDefault | Use the server configuration to merge with the user's local cache configuration. |
Note: Developers who use the parameter delivery SDK need to preset a default configuration into the app through API. The SDK uses this default configuration as an alternative. For specific methods, please refer to the "Set Default Configuration" section.
Code Snippet
SEConfig seConfig = new SEConfig();
seConfig.logEnabled = true;
RCConfig rcConfig = new RCConfig();
rcConfig.enable = true;
rc.mergeType = RCMergeType.byUser;
Dictionary<string, object> customIDProperties = new Dictionary<string, object>();
customIDProperties.Add("id_key1", "id_value1");
customIDProperties.Add("id_key2", "id_value2");
rcConfig.customIDProperties = customIDProperties;
Dictionary<string, object> customIDEventProperties = new Dictionary<string, object>();
customIDEventProperties.Add("event_key1", "event_value1");
customIDEventProperties.Add("event_key2", "event_value2");
rcConfig.customIDEventProperties = customIDEventProperties;
Dictionary<string, object> customIDUserProperties = new Dictionary<string, object>();
customIDUserProperties.Add("user_key1", "user_value1");
customIDUserProperties.Add("user_key2", "user_value2");
rcConfig.customIDUserProperties = customIDUserProperties;
SolarEngine.Analytics.initSeSdk("appkey",seConfig, rcConfig);
Developers need to preset a default configuration into the app through API. The SDK uses this default configuration as an alternative.
Function
public void SetRemoteDefaultConfig(Item[] defaultConfig)
Parameter | Parameter Meaning | Type | Required |
---|---|---|---|
defaultConfig | The default configuration passed by the developer | Item[] | Yes |
We have encapsulated the function accordingly, allowing developers to call the encapsulated method and pass in the default configuration.
Function
public Item stringItem(string name, string value);
public Item intItem(string name, int value);
public Item boolItem(string name, bool value);
public Item jsonItem(string name,Dictionary<string,object> value);
Code Example
SESDKRemoteConfig remoteConfig = new SESDKRemoteConfig();
List<object> list = new List<object>();
list.Add(1);
list.Add(2);
list.Add(3);
Dictionary<string, object> defaultConfig6 = new Dictionary<string, object>();
defaultConfig6.Add("name", "test");
defaultConfig6.Add("age", 1);
defaultConfig6.Add("list", list);
SESDKRemoteConfig.Item itemString = remoteConfig.stringItem("test", "test");
SESDKRemoteConfig.Item itemJson = remoteConfig.jsonItem("testjson", defaultConfig6);
SESDKRemoteConfig.Item itemBool = remoteConfig.boolItem("testbool", true);
SESDKRemoteConfig.Item itemInt = remoteConfig.intItem("testint", 1);
SESDKRemoteConfig.Item[] defaultConfigArray= new SESDKRemoteConfig.Item[]{itemString,itemJson,itemBool,itemInt};
remoteConfig.SetRemoteDefaultConfig(defaultConfigArray);
Developers can set custom event properties, and the parameter delivery SDK will bring this property when requesting server configuration for server-side parameter matching.
Function
public void SetRemoteConfigEventProperties(Dictionary<string, object> properties)
Parameter | Parameter Meaning | Parameter Type | Required |
---|---|---|---|
properties | Custom event properties | Dictionary<string, object> | Yes |
Code Example
SESDKRemoteConfig remoteConfig = new SESDKRemoteConfig();
Dictionary<string, object> eventProperties = new Dictionary<string, object>();
eventProperties.Add("event_pro1", "event_value1");
eventProperties.Add("event_pro2", "event_value2");
remoteConfig.SetRemoteConfigEventProperties(eventProperties);
Note:
Please do not pass custom event properties with keys starting with an underscore "_". The SDK will discard such properties by default.
Developers can set custom user properties. The parameter delivery SDK will bring this property when requesting server configuration for server-side parameter matching.
Function
public void SetRemoteConfigUserProperties(Dictionary<string, object> properties)
Parameter | Parameter Meaning | Parameter Type | Required |
---|---|---|---|
properties | Custom user properties | Dictionary<string, object> | Yes |
Code Example
SESDKRemoteConfig remoteConfig = new SESDKRemoteConfig();
Dictionary<string, object> userProperties = new Dictionary<string, object>();
userProperties.Add("user_pro1", "user_value1");
userProperties.Add("user_pro2", "user_value2");
remoteConfig.SetRemoteConfigUserProperties(userProperties);
Note:
Please do not pass in custom user properties with keys starting with an underscore "_". The SDK will discard such properties by default.
The Remote Config SDK provides two methods for retrieving parameter configuration: synchronous and asynchronous.
Note:
When retrieving parameters synchronously or asynchronously, the SDK will trigger an event to report which test group the user is assigned to. Therefore, it is recommended to retrieve parameters only when the user reaches the test scenario. Please don't retrieve parameters too early.
Function
//Non-Harmony platforms
public string FastFetchRemoteConfig(string key)
//Harmony
public void FastFetchRemoteConfig(string key,Action<string>callback)
Parameter | Parameter Meaning | Type | Required |
---|---|---|---|
key | Parameter delivery key, corresponding to the parameter key configured by the user on the dashboard | String | Yes |
Returned value: Returns the value of the corresponding key, string type.
Code Example
//Non-Harmony platforms
SESDKRemoteConfig remoteConfig = new SESDKRemoteConfig();
//Default string type values returned. Deverlopers can customize data type. Here we provide bool type example.
string result = remoteConfig.FastFetchRemoteConfig("key");
bool boolResult = bool.Parse(result);
//Harmony
remoteConfig.FastFetchRemoteConfig("key", onFetchRemoteConfigCallbacks);
private void onFetchRemoteConfigCallbacks(string result)
{
//Default string type values returned. Deverlopers can customize data type. Here we provide bool type example.
bool boolResult = bool.Parse(result);
}
Function
//Non-Harmony platforms
public Dictionary<string, object> FastFetchRemoteConfig()
//Harmony
public void FastAllFetchRemoteConfig( Action<Dictionary<string, object>> callback)
Returned value: Returns the value of all parameter delivery configurations (Type: Dictionary<string, object>)
Code Example
//Non-Harmony platforms
SESDKRemoteConfig remoteConfig = new SESDKRemoteConfig();
Dictionary<string,object> result = remoteConfig.FastFetchRemoteConfig();
//Harmony
remoteConfig.FastAllFetchRemoteConfig(onFetchRemoteConfigCallback);
private void onFetchRemoteConfigCallback(Dictionary<string, object> result)
{
string str = JsonConvert.SerializeObject(result);
Debug.Log(str);
}
Function
public void AsyncFetchRemoteConfig(string key, FetchRemoteConfigCallback callback)
Parameter | Parameter Meaning | Parameter Type | Required |
---|---|---|---|
key | Parameter delivery key, corresponds to the parameter key configured by the user in the background. | String | Yes |
callback | Parameter delivery asynchronous callback | FetchRemoteConfigCallback | Yes |
Code Example
private void onFetchRemoteConfigCallback(string result) {
//Default string type values returned. Deverlopers can customize data type. Here we provide bool type example.
bool boolResult = bool.Parse(result);
}
SESDKRemoteConfig remoteConfig = new SESDKRemoteConfig();
remoteConfig.AsyncFetchRemoteConfig("key", onFetchRemoteConfigCallback);
Function
public void AsyncFetchRemoteConfig(FetchAllRemoteConfigCallback callback)
Parameter | Parameter Meaning | Parameter Type | Required |
---|---|---|---|
callback | Parameter delivery asynchronous callback | FetchAllRemoteConfigCallback | Yes |
Code Example
private void onFetchAllRemoteConfigCallback(Dictionary<string, object> result) {
//result: all the remote config information fetched asynchronously
}
SESDKRemoteConfig remoteConfig = new SESDKRemoteConfig();
remoteConfig.AsyncFetchRemoteConfig(onFetchAllRemoteConfigCallback);
HarmonyOS Platform
If obfuscation is needed during packaging, please add the following code to the configuration.
./oh_modules/@solarengine/remoteconfig