Menu

Quick Access

Basic Information

Plugin Name: SolarEngine React Native Plugin

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

Plugin Version:  V1.6.7

Please check Changelog to see the lastest SDK versions supported (Default iOS 1.3.0.3, Android  1.2.9.8).

Description: SolarEngine (SE) is an all-in-one mobile app growth analytics and data intelligence platform. It supports data management across global channels, assisting developers to monitor every stage of business development. With our attribution tracking and user-granular 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(APILevel 21) and above.

Step 1: Get AppKey

Access Path:   Asset Management - App Management - AppKey

Step 2: Start Integration

       For applications developed with React Native, it is recommended to integrate SolarEngine SDK React Native plugin using either npm or yarn. Please execute the following command in your project's root directory.

       After the commands are completed, don't forget to update the dependencies for the remote library in the native project.

// If you use npm
npm install solarengine-analysis-react-native

// If you use yarn
yarn add    solarengine-analysis-react-native

Note:

       React Native version 0.60 and above supports autolinking, so you do not need to execute the following react-native link command.

react-native link solarengine-analysis-react-native


If you need to specify the version of native SDK,

// If no platform specified, modify both iOS and Android SDK versions.
node node_modules/solarengine-analysis-react-native/cli.js   set-config  --sdkVersion=1.2.9.8

// Just only modify the iOS SDK version
node node_modules/solarengine-analysis-react-native/cli.js   set-config  --sdkVersion=1.3.0.3   --platform=ios

// Just only modify the Android SDK version
node node_modules/solarengine-analysis-react-native/cli.js   set-config  --sdkVersion=1.2.9.8   --platform=android


If you need to remove "Remote Config & A/B Testing" module,

node node_modules/solarengine-analysis-react-native/cli.js   set-config  -d


If you need to re-activate "Remote Config & A/B Testing" module,

node node_modules/solarengine-analysis-react-native/cli.js   set-config  -e


Android Configuration

       Add the Maven repository configuration as follows:

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"
}

Add the following permissions in the project's AndroidManifest.xml file:

<uses-permission android:name="android.permission.READ_PHONE_STATE" />

      Note:

       The permission android.permission.READ_PHONE_STATE is not necessary. If you're using China Mainland SDK, it's not required to forcibly obtain this permission. If you do acquire this permission and the Android system is above 6.0, please request this permission dynamically.


iOS Configuration

       Suitable for iOS 11.0 and above.

       For Xcode versions, 14.0 and above are supported.

Examples

Example in Github

Step 3: Pre-Initialize SDK

       When the application 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.

Function

export function preInit(appKey: string)

Sample Code

import SolarEngine from 'solarengine-analysis-react-native'; // If your app is published globally
import SolarEngine from 'solarengine-analysis-react-native-cn'; // If your app is published only in China Mainland

let appKey = ""; 
if (Platform.OS === 'ios') {
   appKey = "your_iOS_appkey";// Input your own iOS appkey
} else if (Platform.OS === 'android') {
   appKey = "your_Android_appkey";//  Input your own Android appkey
}    
SolarEngine.preInit(appKey);


Step 4: Initialize SDK

Function

export function initialize(appKey:string,options:SolarEngineInitiateOptions,completion: (result: InitiateCompletionInfo) => void) 
ParameterDescriptionTypeRequired
appKeyAppkey you obtained in Step 1stringYes
optionsSolarEngine SDK configurationSolarEngineInitiateOptionsYes
completionInitialization callback infoInitiateCompletionInfoYes

SolarEngineInitiateOptions description:

ParameterDescriptionTypeRequired
configSDK related configse_initial_config no
remoteConfigA/B Testing and Remote Config related configRemoteConfigno
attributionTo receive attribution callback informationattributionno
deeplinkTo receive deeplink callback informationdeeplinkno
deferredDeeplinkTo receive deferred deeplink callback informationdeferredDeeplinkno

se_initial_config description:

ParameterDescriptionTypeRequired
enableLogWhether to enable debugging logs (default off)booleanNO
enableDebugWhether to enable Debug mode
(default off)
booleanNO
enable2GWhether to enable data reporting in 2G environment (default false)booleanNO
enableGDPRIf your product is operated within the EU region, there will be GDPR restrictions to follow. (default false)booleanNO
enablePersonalizedAdWhether users allow Google to use their data for ad personalization. If not set, this field will not be reported. Only applicable for Android as there is no such field for iOS.booleanNO
enableUserDataWhether users allow their personal data to be shared with Google. If not set, this field will not be reported. Only applicable for Android as there is no such field for iOS.booleanNO
enableCoppaWhether your app is required to comply with Children's Online Privacy Protection Rule ("COPPA"). Default false.booleanNO
enableKidsAppWhether your app is targeting kids under 13 years old and needs to be marked as "Kids App" category. Default false.booleanNO
enableDeferredDeeplinkWhether to enable deferred deep linking, default False.booleanNO
android.metaAppIdIf Non-China-Mainland developers need to use Meta attribution, set meta appid here.stringNO
ios.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
ios.caidOnly for China Mainland SDKstringNO


RemoteConfig description:

ParameterDescriptionTypeRequired
enabledWhether to enable Remote Config SDK (default false)booleanYES
mergeTypeSDK configuration merge strategy:
By default, server configurations are merged with local cached configurations. For specific definitions, please refer to the explanation below.
RemoteConfigMergeTypeNO
customIDPropertiesCustom ID, corresponding to those set on SE dashboardObjectNO
customIDEventPropertiesCustom ID event properties, corresponding to those set on SE dashboardObjectNO
customIDUserPropertiesCustom ID user properties, corresponding to those set on SE dashboardObjectNO


RemoteConfigMergeType description:

ParameterDescription
UserWhen the app is first launched or updated, the server configuration is merged with the user's default configuration. This method can clear the local cached configuration.
CacheMerge the server configuration with the user's existing local cached configuration; this is the default merge strategy for the Remote Config SDK.


To receive attribution callback information:

type attribution = (code:number,attribution?:Object) => void;

To receive deeplink callback information:

type deeplink = (code:number,deepLinkInfo?:DeepLinkInfo) => void;

DeepLinkInfo

ParameterDescriptionType
sedpLinkredirect parametersstring
turlId7-character short linkstring
fromlink typestring
customParamscustom parametersObject


To receive deferred deeplink callback information:

type deferredDeeplink = (code:number,deferredDeepLinkInfo?:DeferredDeepLinkInfo) => void;

DeferredDeepLinkInfo

ParameterDescriptionType
sedpLinkredirect parametersstring
turlId7-character short linkstring
sedpUrlschemeThe URL Scheme you input when creating deep linkingstring


Sample Code

async function Initiate(){
  log("Initiate" );

  let appKey = "";
  if (Platform.OS === 'ios') {
     appKey = "your_iOS_appKey";
  } else if (Platform.OS === 'android') {
     appKey = "your_Android_appKey";
  }    
  let config:se_initial_config = buildInitialConfig();
  let remoteConfig:RemoteConfig = buildRemoteConfig();
  let attribution:attribution = buildAttribution();
  let deeplink:deeplink = buildDeeplinkResponse();
  let deferredDeeplink: deferredDeeplink = buildDeferredDeeplinkResponse();

  let initiateOptions:SolarEngineInitiateOptions = {
    config:config,
    remoteConfig:remoteConfig,
    attribution:attribution,
    deeplink:deeplink,
    deferredDeeplink:deferredDeeplink
  }
  SolarEngine.initialize(appKey,initiateOptions,(result:InitiateCompletionInfo) => {
    if (result.success) {
      Alert.alert('SolarEngine SDK Initiate Complete!')
    }
  });

}


SDK related config

function buildInitialConfig():se_initial_config{
  let config:se_initial_config = {
    enableLog: true,
    enableDebug: false,
...
  };
  return config;
}


Remote Config & A/B Testing related config

function buildRemoteConfig():RemoteConfig{
  let remoteConfig:RemoteConfig = {
    enabled:true,
    mergeType:RemoteConfigMergeType.Cache, 
    customIDProperties:{"name":"name_value"},
    customIDEventProperties:{"age":28},
    customIDUserProperties:{"key":"value"},
  }
  return remoteConfig;
}


To receive attribution callback information:

function buildAttribution():attribution{

  const handleAttribution:attribution = (code:number,attributionInfo?:Object) => {
    console.log("attribution code: " + code);
    if (code === 0){
        console.log("attributionInfo: " + JSON.stringify(attributionInfo));
        const typedValue = attributionInfo as {channel_name : string,
        attribution_time:string, 
        re_data: object};
        console.log("channel_name: " + typedValue.channel_name)
        console.log("attribution_time: " + typedValue.attribution_time)
        const re_dataValue = typedValue.re_data as {install_time:string,
        report_time:string
      }
      if(typedValue.re_data != null){
        console.log("re_data.install_time: " + re_dataValue.install_time)
        console.log("re_data.report_time: " + re_dataValue.report_time)
      }else{
        console.log("re_data: is null" )
      }
    }
  }
  return handleAttribution;
}


To receive deeplink callback information:

function buildDeeplinkResponse():deeplink{
  const handleDeepLink: deeplink = (code:number,deepLinkInfo?: DeepLinkInfo) => {
    if(code === 0){
      if(deepLinkInfo){
        console.log("deepLinkInfo.sedpLink: " + deepLinkInfo.sedpLink);
      }
    }else{
      console.log("code: " + code);
    }
  };
  return handleDeepLink;
}


To receive deferred deeplink callback information:

function buildDeferredDeeplinkResponse(): deferredDeeplink {
  const handleDeferredDeeplink: deferredDeeplink = (
    code: number,
    deferreddeeplink?: DeferredDeepLinkInfo
  ) => {
    if (code === 0) {
      if (deferreddeeplink) {
        log('deferreddeeplink.sedpLink: ' + deferreddeeplink.sedpLink);
      }
    } else {
      log('code: ' + code);
    }
  };
  return handleDeferredDeeplink;
}


InitiateCompletionInfo error codes:

101SDK is not pre-initialized
102illegal appkey
103null context(Android only)
104distinct_id creation failed(Android only)


Step 5: Get Attribution Results

       The SDK provides an interface to obtain attribution result information, which developers can use for tracking and other logical processing.

       The SDK offers two methods to retrieve attribution result information:

  1. Set Attribution Result Callback: When the SDK successfully retrieves the attribution result or fails to do so, it will provide a callback (this is an asynchronous callback).
  2. Directly Get Attribution Result: Retrieve the attribution result directly from the SDK's cache. If the SDK does not yet have an attribution result, it will return null (this is a synchronous return).

Set Attribution Result Callback

       Please refer to above "To receive attribution callback information" part.

 

Get Attribution Data Directly

Function

export function retrieveAttribution(): Object|null;

Sample Code

function retrieveAttribution(){

  let attribution:Object|null = SolarEngine.retrieveAttribution();
  if (attribution != null) {
    log('attribution: ' + JSON.stringify(attribution));

    const object = attribution as { channel_name: string; attribution_time: string};
    log("channel_name:" + object.channel_name);  
    log("attribution_time:" + object.attribution_time);  
  }else{
    log("attribution is null");
  }
}


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

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



Previous
React Native
Next
Optional Features
Last modified: 2025-08-07Powered by