Menu

Quick Access

SDK Basic Information

SDK Name: SolarEngine CocosCreator SDK v1.0.1

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

SDK Version: 1.0.1

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 Non-China-Mainland, please download SDK via: SolarEngineSDK-Cocos-US

       If your product data is stored in China Mainland, please download SDK via: SolarEngineSDK-Cocos-CN

      Please check from the dashboard:

2.2 Obtain SDK Demo

       Please download via: SolarEngineSDK-Cocos-Demo

After download, please follow the steps below to run the demo:

1. The SDK in the demo is Non-China-Mainland version. If your app is published in China Mainland only, please replace the SolarEngineSDK in the demo with the SolarEngineSDK-Cocos-CN provided above.

2. After exporting the Android or iOS native project from Cocos, place the SolarEngineSDK into the native project and export the Android or iOS native project again. For detailed instructions, refer to the section below: "Step 3: Integrate SDK".

Step 3: Integrate SDK

3.1 Android

   Dependencies required for adding the SDK

1.  Export the Android native project

   In the CocosCreator editor, go to the top menu Project -> Build and select the Android platform. After clicking "Build," an Android native project will be generated.

2.  Add SolarEngine Android SDK dependencies

   Open the exported Android project using Android Studio and compile it (ensure there are no compilation issues).

   Maven repository configuration

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

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        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/" }
    }
}

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

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

implementation 'com.reyun.solar.engine.oversea:solar-engine-core:1.3.1.0'
implementation 'com.reyun.solar.engine.oversea:solar-remote-config:1.3.1.0'

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

implementation 'com.reyun.solar.engine.china:solar-engine-core:1.3.1.0'
implementation 'com.reyun.solar.engine.china:solar-remote-config:1.3.1.0'

3.  Add the SolarEngine Android SDK CocosCreator Wrapper file

   Place the downloaded SECocosCreatorProxyApi.java file in the /native/engine/android/app/src/com/cocos/game/ directory of the project.

4.  After completing the configuration, simply re-export the Android project like the first step above.


If obfuscation needs to be added 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.**{*;}

3.2 iOS

       For Xcode versions, 14.0 and above are supported.

       Accessible for iOS 11.0 and later.

1. Export the iOS native project

   In the CocosCreator editor, go to the top menu Project -> Build, select the iOS platform, and click "Build." This will generate an iOS native project.

2.  Add SolarEngine iOS SDK dependencies

   Navigate to the /native/engine/ios/ directory and place the downloaded SolarEngineSDK iOS-related files into the /native/engine/ios/ directory.

Add the following code to native/engine/ios/CMakeLists.txt

// First find this line
set(CC_ALL_SOURCES)

// Then add
list(APPEND CC_PROJ_SOURCES
    ${CMAKE_CURRENT_LIST_DIR}/SolarEngineSDK/iOS/SECocosCreatorProxyApi.h
    ${CMAKE_CURRENT_LIST_DIR}/SolarEngineSDK/iOS/SECocosCreatorProxyApi.mm
)

Add the following code to native/engine/ios/Post-service.cmake

if(IOS)
    # Supported for .framework
    cs_neteaseyidun_append_string_property(${CC_TARGET_NAME} XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS ${CMAKE_CURRENT_LIST_DIR}/SolarEngineSDK/iOS/Frameworks)

    cs_neteaseyidun_append_string_property(${CC_TARGET_NAME} XCODE_ATTRIBUTE_OTHER_LDFLAGS "-ObjC -fprofile-instr-generate -lz -lc++")
    target_link_libraries(${CC_TARGET_NAME} "-framework SolarEngineSDK")
    target_link_libraries(${CC_TARGET_NAME} "-framework SESDKRemoteConfig")
    target_link_libraries(${CC_TARGET_NAME} "-framework AdSupport")
    target_link_libraries(${CC_TARGET_NAME} "-framework AdServices")
    target_link_libraries(${CC_TARGET_NAME} "-framework Security")
    target_link_libraries(${CC_TARGET_NAME} "-framework CoreTelephony")
endif()

Add the following code to native/engine/ios/Pre-service.cmake

if(IOS)
    # Supported for link *.framework
    function(cs_neteaseyidun_append_string_property target property value)
      get_property(pre_value TARGET ${target} PROPERTY ${property})
      list(APPEND pre_value " ${value}")
      set_property(TARGET ${target} PROPERTY ${property} "${pre_value}")
    endfunction()
endif()

3. After completing the configuration, simply re-export the iOS project like the first step above.

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.

import solarengine from './SEScript/SolarEngine.js'
// ./SEScript/SolarEngine.js  (Please update it to the actual SDK directory in your project.)

solarengine.preInitSDK(appkey)

Step 5: Initialize SDK

SDK Initialization Parameters

ParameterDescriptionTypeRequired
appKeyAppKey you obtained in Step 1StringYes
configSolarEngine SDK initialization configObjectYes

"config" parameters description:

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

"remoteConfig" parameters description:

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:

import solarengine from './SEScript/SolarEngine.js'

let appkey = ''

solarengine.initSDKCallback((code) => {

    if (code == 0) {
        console.log("init success ...")
    } else {
        console.log("init fail ...")
    }
})

solarengine.preInitSDK(appkey)

let config = {
    "logEnabled": true
};

solarengine.initSDK(appkey, 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

The SDK provides an interface to obtain attribution result information, allowing developers to use the attribution data for event tracking and other logical processing.        

SolarEngine SDK provides two methods for obtaining attribution result information.

1. Set attribution result callback: When the SDK successfully or fails to obtain the attribution result, a callback will be given (asynchronous).

2. Get attribution result directly: Get the attribution results directly from the SDK cache. If the SDK has no attribution results yet, it will directly return nil (synchronous).

6.1 Set Attribution Result Callback

Sample Code

import solarengine from './SEScript/SolarEngine.js'

let appkey = ''

solarengine.attributionCallback((result) => {
    let code = result.code
    if (code == 0) {
        console.log("attribution success ...")
        let data = result.data
        console.log(JSON.stringify(data))
    } else {
        console.log("attribution fail ...")
        console.log(code)
    }
})

solarengine.preInitSDK(appkey)

let config = {
"logEnabled": true
};

solarengine.initSDK(appkey, config)

6.2 Get Attribution Result Directly

Sample Code

const attribution = solarengine.getAttribution();
console.log(" attribution = ",attribution);	

6.3 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
CocosCreator SDK
Next
Optional Features
Last modified: 2025-09-23Powered by