integrationlatestIntegration / Native support
Native support
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 iOSas 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.hLayaProxyApi.mmThinkingSDK.framework
-
Configure Build Settings
- In
Other Linker Flags, add-ObjC
- In
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 studioas 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.javatodemo, as shown below
- Copy
ThinkingSDK.aarto theapp/libsdirectory of the project
- Add the dependency to the
build.gradlefile underModule: add'*.aar'to theincludeof the existingfileTreedependency, 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?

