Skip to main content

Native support

Last updated 10/03/2026

1. iOS Native support​

1.1 Build the iOS project​

  • Build preparation

    • Publish the Web platform app and record the path of the published files
  • Build configuration

    • Open the Menu > Tools > App Build screen
    • Select XCode iOS as the project type and select Standalone
    • For the resource path, select the publish path of the Web platform app

1.2 Configure the iOS project​

  • Add the iOS project dependency files

    • LayaProxyApi.h
    • LayaProxyApi.mm
    • ThinkingSDK.framework
  • Configure Build Settings

    • In Other Linker Flags, add -ObjC

2. Android Native support​

2.1 Build the Android project​

  • Build preparation

    • Publish the Web platform app and record the path of the published files
  • Build configuration

    • Open the Menu > Tools > App Build screen
    • Select Android studio as the project type and select Standalone
    • For the resource path, select the publish path of the Web platform app

2.2 Configure the Android project​

  • In the app project in the Android view, add the dependency file LayaProxyApi.java to demo, as shown below
  • Copy ThinkingSDK.aar to the app/libs directory of the project
  • Add the dependency to the build.gradle file under Module: add '*.aar' to the include of the existing fileTree dependency, and keep the existing '*.jar'
dependencies {
...
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
}

3. Enable Native support​

When you initialize the SDK, add enableNative: true to config to enable Native support.

// TA SDK configuration object
var config = {
appId: "YOUR_APPID", // Project APP ID
serverUrl: "YOUR_SERVER_URL", // Data reporting URL
enableNative: true, // Allow calling Native code
autoTrack: {
appShow: true, // Auto-track the launch event
appHide: true, // Auto-track the close event
appClick: true, // Auto-track the click event (Native only)
appView: true, // Auto-track the view event (Native only)
appCrash: true, // Auto-track the crash event (Native only)
appInstall: true // Auto-track the install event (Native only)
}
};

// Initialize
TDAnalytics.init(config);
// Report a simple event named test_event
TDAnalytics.track({
eventName: "test_event"
});
Was this page helpful?