Menu

Quick Access

SDK Basic Information

SDK Name: SolarEngine Cocos2d-x SDK v1.0.3

Developer: Huiliang Cloud (Beijing) Technology Co., Ltd.

SDK Version: 1.0.3

Features: SolarEngine (SE) is an all-in-one mobile app growth analytics and publishing intelligence platform. It supports data management across global channels, assisting developers to monitor every stage of business development. With our attribution and user-level ROI analysis, you'll be able to measure the true value every channel creates and optimize future growth strategies. SE also offers various analysis models and A/B testing feature to help fully visualize the user journey, identify potential pain points, implement targeted product enhancements and ultimately drive large-scale app growth.

Privacy Policy: https://www.solar-engine.com/privacyPolicyEN.html

Note:

The SolarEngine SDK supports Android 5.0 (API Level 21) and above.

Step 1: Get AppKey

Access Path:  Asset Management - App Management - AppKey

Please login to the live version and get appkey for your own product.

Step 2: Obtain SDK

2.1 Obtain SDK

If your product data is stored in China Mainland, please download SDK via:

https://solar-sdk.oss-cn-beijing.aliyuncs.com/Cocos2d-x/SolarEngineSDK-Cocos2dx-CN-1.0.3.zip

If your product data is stored in Non China Mainland, please download SDK via:

https://solar-sdk.oss-cn-beijing.aliyuncs.com/Cocos2d-x/SolarEngineSDK-Cocos2dx-US-1.0.3.zip

Please check from the dashboard:

Step 3: Integrate SDK

Integrate SolarEngine SDK

       Copy the entire downloaded SolarEngineSDK directory into the Classes/ folder.

Configure CMakeLists

       Add the following configuration to your CMakeLists.txt .

list(APPEND GAME_SOURCE
     Classes/SolarEngineSDK/Common/SEJSONObject.cpp
     )
list(APPEND GAME_HEADER
     Classes/SolarEngineSDK/Common/SEJSONObject.h
     Classes/SolarEngineSDK/Common/SolarEngineAPI.h
     )
if(ANDROID)
    list(APPEND GAME_SOURCE
         Classes/SolarEngineSDK/Android/SolarEngineAPI.cpp
         )
elseif(APPLE)
    if(IOS)
        list(APPEND GAME_HEADER
             Classes/SolarEngineSDK/Common/SolarEngineAPI.h
             )
        list(APPEND GAME_SOURCE
             Classes/SolarEngineSDK/iOS/SolarEngineAPI.mm
             )
    endif()
endif()

if(APPLE)
    elseif(IOS)
        set_xcode_property(${APP_NAME} OTHER_LDFLAGS "$(inherited) -ObjC")
    endif()
endif()

Android

1. Add the required dependency frameworks for the SDK

    • Add the SolarEngine Android SDK dependencies
    • Open the Android project in Android Studio and build it

2. Maven repository configuration

   You need to add the Maven repository configuration to the build.gradle file in the project's root directory. The specific configuration is as follows:

allprojects {
    repositories {
        google()
        jcenter()

        // SolarEngine SDK repository URL
        maven { url "https://maven-android.solar-engine.com/repository/se_sdk_for_android/" }
        maven { url "https://developer.huawei.com/repo/" }
        maven { url "https://developer.hihonor.com/repo/" }
        maven { url 'https://artifact.bytedance.com/repository/pangle'}
    }
}

Please add the following code to the build.gradle file of the project.

       If your product data is stored in China Mainland, please use:

implementation 'com.reyun.solar.engine.china:solar-engine-core:1.3.4'

       If your product data is stored in Non China Mainland, please use:

implementation 'com.reyun.solar.engine.oversea:solar-engine-core:1.3.4'

3.  Add the SolarEngine Android SDK Cocos2d-x Wrapper file

Place the downloaded SolarEngineSDK/Android/com/solar/engine/SolarEngineCocosAPI.java file in the proj.android/app/src/ of the project.

Note: Place the entire /com/solar/engine/SolarEngineCocosAPI.java directory and docs together.

If obfuscation is needed during packaging, please add the following code to the obfuscation configuration file.

-keep class com.reyun.** {*; }
-keep class route.**{*;}
-keep interface com.reyun.** {*; }
-keep interface route.**{*;}
-dontwarn com.reyun.**
-dontwarn org.json.**
-keep class org.json.**{*;}
# Google lib库
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
    com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
    java.lang.String getId();
    boolean isLimitAdTrackingEnabled();
}
-keep public class com.android.installreferrer.** { *; }
# If you need to obtain OAID, please add the following obfuscation 
-keep class com.huawei.hms.**{*;}
-keep class com.hihonor.**{*;}

iOS

       For Xcode versions, 14.0 and above are supported.

       Accessible for iOS 11.0 and later.

1. Build the iOS project.

2. Add the iOS SDK to your Cocos2d-x Xcode project.

Click Finish

Add Required Dependency Frameworks

  • Security.framework — Used to store device identifiers.
  • CoreTelephony.framework — Used to retrieve carrier information.
  • AdSupport.framework — Used to obtain the Advertising Identifier (IDFA).
  • SystemConfiguration.framework — Used to check the current network environment.
  • libsqlite3.tbd — Used for data storage.
  • AdServices.framework — Used to retrieve ad attribution data.

Note: If you need ASA attribution, AdServices.framework must be added; or attribution results cannot be obtained.

How to Add:

In your Xcode project, navigate to TARGETS → Build Phases → Link Binary With Libraries, click the + button, and select the following libraries:

Security.framework, CoreTelephony.framework, AdSupport.framework, SystemConfiguration.framework, libsqlite3.tbd, AdServices.framework

Step 4: Pre-Initialize SDK

       When the app is first launched after install, the SDK is pre-initialized. During pre-initialization, the SDK does not collect any personal information or report data to SolarEngine.

#include "./SolarEngineSDK/Common/SolarEngineAPI.h"
#include "./SolarEngineSDK/Common/SEJSONObject.h"
// Classes/SolarEngineSDK/Common/SolarEngineAPI.h 

SolarEngineAPI::preInit(seAppKey);

Step 5: Initialize SDK

SDK Initialization Parameters

ParameterDescriptionTypeRequired
appKeyAppKeyStringYes
configSolarEngine SDK initialization configObjectYes

1. Core Feature Switches

       It controls the enablement or disablement of core SDK capabilities, directly determining whether core services such as attribution and analytics take effect.

       Note: Disabling relevant core feature switches will disrupt the data reporting. You will no longer be able to fully utilise all functions within SolarEngine dashboard.

ParameterDescriptionTypeRequired
enableAttributionWhether to enable SolarEngine attribution service. Enabled by default. Disabling it will turn off all attribution relevant capabilities, including attribution results, deferred deeplink and deeplink, etc. If the analytics service is disabled at the same time, the SDK will stop reporting all data.booleanNo
enableAnalyticsWhether to enable SolarEngine analytics service. Enabled by default. Disabling it can make all analytics features unavailable, such as A/B testing and online parameter. If the attribution service is disabled at the same time, the SDK will stop reporting all data.booleanNo

2. Auxiliary Feature Switches

ParameterDescriptionTypeRequired
logEnabledWhether to enable debugging logs (Default false)booleanno
isGDPRAreaIf your product is operated within the EU region, there will be GDPR restrictions to follow. Please make sure to set isGDPRArea(true) if users reject the device information collection. (Default false)

GDPR regions:
- send 0 if user agrees
- send 1 if user disagrees

Non-GDPR regions:
- Always send 0
booleanno
adPersonalizationEnabledIf your product is operated within the EU region and advertised on Google, please send the results about whether users allow Google to use their data for ad personalization into this parameter, so that you will comply with Google's EU user consent policy.booleanno
adUserDataEnabledIf your product is operated within the EU region and advertised on Google, please send the results about whether users allow their personal data to be shared with Google into this parameter, so that you will comply with Google's EU user consent policy.booleanno
fbAppIDIf you need to enable Meta attribution, set Meta appid here. Only Android need to use this parameter. For iOS, please ignore this step.stringno
attAuthorizationWaitingIntervalSupports ATT Authorization Waiting for up to 120 seconds when iOS devices report events for the first time. Then SDK will report the install event only after users authorize ATT or when waiting time is up. (Unit: second)numberno
isDebugModelWhether to enable Debug mode (Default off). Before using, please check function description.booleanno
isCoppaEnabledWhether your app is required to comply with Children's Online Privacy Protection Rule ("COPPA"). Default false.booleanno
isKidsAppEnabledWhether your app is targeting kids under 13 years old and needs to be marked as "Kids App" category. Default false.booleanno
enableDelayDeeplinkWhether to enable deferred deep linking, default False. booleanno
remoteConfigRemote config initializationSEUniRemoteConfigno
enableSeparatedAttributionWhether enable the new attribution feature to quickly retrieve attribution results once activated.booleanno

3. Data Collection Switches

       It controls whether data such as IPv6, OAID and UA is collected.

       Note: Disabling corresponding data collection parameters will impair attribution and analytics services, and you will not be able to use relevant functions normally on SolarEngine dashboard.

ParamterDescriptionTypeRequired
enableLanguageWhether to collect device language. Set to false to disable collection. Default true (enabled).booleanNo
enableLocaleWhether to collect device locale. Set to false to disable collection. Default true (enabled).booleanNo
enableTimeZoneWhether to collect device time zone. Set to false to disable collection. Default true (enabled).boolenNo
enableScreenWHWhether to collect screen width and height. Set to false to disable collection. Default true (enabled).booleanNo
enableNetworkTypeWhether to collect network status. Set to false to disable collection. Default true (enabled).stringNo
enableUAWhether to collect User-Agent (UA). Set to false to disable collection. Default true (enabled).numberNo
enableIPV6Whether to collect IPv6 address. Set to false to disable collection. Default true (enabled).(Only China mainland)booleanNo

RemoteConfig Parameter Description (Online Parameter Feature)

ParameterDescriptionTypeRequired
enableWhether to enable Remote Config SDK (Default false)boolno
mergeTypeSDK configuration merge strategy: By default, the server configuration is merged with the local cache configuration.

0: When the app is first launched or after a version update, the server configuration is merged with the user's default configuration. This method can clear the local cache configuration.

1: The server configuration is merged with the user's existing local cache configuration. (Default)
boolno
customIDEventPropertiesCustom ID event property value, matching the event properties set by developers on the dashboard.boolno
customIDUserPropertiesCustom ID user property value, matching the user properties set by developers on the dashboard.


Initialization Example:

#include "./SolarEngineSDK/Common/SolarEngineAPI.h"
// Classes/SolarEngineSDK/Common/SolarEngineAPI.h 

// Listen to attribution results
SolarEngineAPI::setInitCallback([this](int resultCode) {
    if (resultCode == 0) {
        CCLOG("SolarEngine SDK InitCallback success");
    } else {
        CCLOG("SolarEngine SDK InitCallback fail,code: %d", resultCode);
    }
});


SECConfig config;
config.enableLog = true; // Enable debug logs
SolarEngineAPI::init(seAppKey, config);


Initialization callback codes:

codemeaning
0Initialization success
101Initialization failed, as pre-initialization is not called
102Initialization failed, due to illegal appkey
103Initialization failed, due to null context (Android only)
104Initialization failed, due to missing distinct_id (Android only)

Step 6: Get Attribution Results

6.1 Set Attribution Result Callback (New)

// Get UA attribution data callback
SolarEngineAPI::setUAAttributionDataCallback([this](const AttributionData &attr) {
      if (attr.code == 0) {
          CCLOG("[SE] AttributionData: success , install_time=%s, channel_name=%s, origin_data_str=%s",
                attr.code, attr.install_time.c_str(), attr.channel_name.c_str(),
                attr.origin_data_str.c_str());
      } else {
          CCLOG("[SE] AttributionData: fail code=%d",
                attr.code);
      }
});

// Get Re-engagement attribution data callback
SolarEngineAPI::setREAttributionDataCallback([this](const AttributionData &attr) {
      if (attr.code == 0) {
          CCLOG("[SE] AttributionData: success , install_time=%s, channel_name=%s, origin_data_str=%s",
                attr.code, attr.install_time.c_str(), attr.channel_name.c_str(),
                attr.origin_data_str.c_str());
      } else {
          CCLOG("[SE] AttributionData: fail code=%d",
                attr.code);
      }
});


SECConfig config;
config.enableLog = true; // Enable debug logs
config.enableSeparatedAttribution = true;  // Enable new attribution feature, or attribution results cannot be obtained.
SolarEngineAPI::init(seAppKey, config);

6.2 Get Attribution Result Directly (New)

       In addition to adding an attribution callback during initialization, you can also proactively call the API later in your business logic to read the attribution results.

// Get UA attribution results directly
AttributionData uaAttr = SolarEngineAPI::getUAAttributionData();
if (uaAttr.code == 0) {
    CCLOG("[SE] AttributionData: ua success , install_time=%s, channel_name=%s, origin_data_str=%s",
          uaAttr.code, uaAttr.install_time.c_str(), uaAttr.channel_name.c_str(),
          uaAttr.origin_data_str.c_str());
} else if (uaAttr.code == -1) {
     // Attribution data not yet obtained
    CCLOG("[SE] AttributionData: ua not data .");
} else {
    CCLOG("[SE] AttributionData: ua fail code=%d",uaAttr.code);
}

// Get Re-engagement attribution results directly
AttributionData reAttr = SolarEngineAPI::getREAttributionData();
if (reAttr.code == 0) {
    CCLOG("[SE] AttributionData: ua success , install_time=%s, channel_name=%s, origin_data_str=%s",
          reAttr.code, reAttr.install_time.c_str(), reAttr.channel_name.c_str(),
          reAttr.origin_data_str.c_str());
} else if (reAttr.code == -1) {
     // Attribution data not yet obtained
    CCLOG("[SE] AttributionData: ua not data .");
} else {
    CCLOG("[SE] AttributionData: ua fail code=%d",reAttr.code);
}

Attribution Result Example

Attribution error code descriptions and detailed attribution results can be found in:

https://help.solar-engine.com/en/docs/SDK-Attribution-Result-Details

Previous
Cocos2d-x SDK
Next
Optional Features
Last modified: 2026-09-21Powered by