Skip to content

UniApp Application Integration


Prerequisites

Note: If you have activated the RUM Headless service, the prerequisites have already been automatically configured for you, and you can directly integrate the application.

Application Integration

  1. Go to User Access Monitoring > Create Application > Android/iOS;
  2. Create two applications for UniApp Android and UniApp iOS respectively to receive RUM data from Android and iOS platforms;
  3. Enter the corresponding application name and application ID for each platform's application;
  4. Choose the application integration method:
    • Public DataWay: Directly receive RUM data without installing the DataKit collector.
    • Local Environment Deployment: Receive RUM data after meeting the prerequisites.

Installation

Local Usage

Source Code: https://github.com/GuanceCloud/datakit-uniapp-native-plugin

Demo: https://github.com/GuanceCloud/datakit-uniapp-native-plugin/Hbuilder_Example

Downloaded SDK package structure description

|--datakit-uniapp-native-plugin
  |-- Hbuilder_Example            // GCUniPlugin plugin example project
    |-- uni_modules           
      |-- GC-JSPlugin         // ⭐️ GC-JSPlugin JS Plugin Package ⭐️
      |   |-- js_sdk          // Folder containing js files
            |-- View/GCPageMixin.js  // View auto-capture using js, GCPageMixin.js used with GCWatchRouter.js
            |-- View/GCWatchRouter.js // View auto-capture using js, GCPageMixin.js used with GCWatchRouter.js
            |-- View/GCPageViewMixinOnly.js  // View auto-capture using js, GCPageViewMixinOnly.js used alone
            |-- Request/GCRequest.js         // Resource and trace using js, providing APM and network request monitoring capabilities
            |-- Error/GCErrorTracking.js     // Error auto-capture using js, supporting uni.onError, console.error
      |   |-- index.js        
      |   |-- package.json    // Plugin configuration file
    |-- nativeplugins             // Example project's local plugin folder
          |-- GCUniPlugin         // ⭐️ GCUniPlugin Native Plugin Package ⭐️
          |   |-- android         // Folder containing android plugin dependencies and resource files
          |   |-- ios             // Folder containing ios plugin dependencies and resource files
          |   |-- package.json    // Plugin configuration file
  |-- UniPlugin-Android           // Plugin development Android main project 
  |-- UniPlugin-iOS               // Plugin development iOS main project 

Configure the GCUniPlugin folder to your uni_app project's "nativeplugins" directory. Also, in the manifest.json file, under "App Native Plugin Configuration," click "Select Local Plugin" and choose the GCUniPlugin plugin from the list:

img

Configure the GC-JSPlugin folder to your uni_app project's "uni_modules" directory.

Note: After saving, you need to submit a cloud build (creating a Custom Base also counts as a cloud build) for the plugin to take effect.

For more details, refer to: Using Local Plugins in HBuilderX, Custom Base

Market Plugin Method

(Not provided)

Uni Mini Program SDK Installation

Development Debugging and wgt Release Usage

  • When developing and debugging the uni mini program SDK, you need to use the Local Usage method to integrate GCUniPlugin.

  • When the uni mini program SDK is packaged as a wgt package for use by the host App, the host App needs to import the GCUniPlugin dependency library (including the Native SDK library) and register the GCUniPlugin Module.

Host App needs to perform the following operations:

iOS

  • Add GCUniPlugin dependency library

    In the Xcode project, select the project name in the left directory, click the "+" button in TARGETS -> Build Phases -> Link Binary With Libaries, then click Add Other -> Add Files..., and open the GCUniPlugin/ios/ dependency library directory. Select FTMobileSDK.xcframework and GC_UniPlugin_App.xcframework in the directory, and click open to add the dependency library to the project.

    When SDK Version < 0.2.0: In TARGETS -> General -> Frameworks,Libaries,and Embedded Content, find FTMobileSDK.xcframework and change the Embed method to Embed & sign.

  • Register GCUniPlugin Module:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    ....
      //  Register GCUniPlugin module
    [WXSDKEngine registerModule:@"GCUniPlugin-MobileAgent" withClass:NSClassFromString(@"FTMobileUniModule")];
    [WXSDKEngine registerModule:@"GCUniPlugin-RUM" withClass:NSClassFromString(@"FTRUMModule")];
    [WXSDKEngine registerModule:@"GCUniPlugin-Logger" withClass:NSClassFromString(@"FTLogModule")];
    [WXSDKEngine registerModule:@"GCUniPlugin-Tracer" withClass:NSClassFromString(@"FTTracerModule")];  
      return YES;
    }

Android

  • Add GCUniPlugin dependency library

  • Method 1: Add ft-native-[version].aar, ft-sdk-[version].aar, and gc-uniplugin-[last-version].aar from the GCUniPlugin/android/ folder to the project's libs folder, and modify the build.gradle file to add dependencies.

  • Method 2: Use the Gradle Maven remote repository for configuration. The configuration method can refer to the UniAndroid-Plugin Project Configuration.
  dependencies {
      implementation files('libs/ft-native-[version].aar')
      implementation files('libs/ft-sdk-[version].aar')
      implementation files('libs/gc-uniplugin-[last-version].aar')
      implementation 'com.google.code.gson:gson:2.8.5'
  }   
  • Register GCUniPlugin Module:
  public class App extends Application {
      @Override
      public void onCreate() {
          super.onCreate();
          try {
            //  Register GCUniPlugin module
              WXSDKEngine.registerModule("GCUniPlugin-Logger", FTLogModule.class);
              WXSDKEngine.registerModule("GCUniPlugin-RUM", FTRUMModule.class);
              WXSDKEngine.registerModule("GCUniPlugin-Tracer", FTTracerModule.class);
              WXSDKEngine.registerModule("GCUniPlugin-MobileAgent", FTSDKUniModule.class);
          } catch (Exception e) {
              e.printStackTrace();
          }
          ......
      }
  }

UniApp SDK and Native SDK Mixed Usage

  • When adding the GCUniPlugin dependency library as described above, the Native SDK has already been added to the host project, so you can directly call Native SDK methods.

  • SDK Initialization

    When using mixed mode, only the host App needs to initialize the Native SDK. The uni mini program does not need to perform additional initialization configuration and can directly call the methods provided by the UniApp SDK.

    The SDK initialization method in the host App can be found in iOS SDK Initialization Configuration and Android SDK Initialization Configuration.

    Note: Please ensure that the SDK initialization is completed in the host App before loading the uni mini program to ensure that the SDK is fully ready before calling any other SDK methods.

  • Additional Configuration for Android Integration:

    Configure the Gradle Plugin ft-plugin to collect App launch events and network request data, as well as Android Native related events (page jumps, click events, Native network requests, WebView data).

  • Distinguish between uni mini program and Native collected data:

    Supported in SDK 0.2.4 and above

    You can add BridgeContext in the uni mini program to filter or associate data for specific scenarios based on the set key-value pairs.

    For example: You can filter wgt_id:wgt_id_1 to view the data collected by the uni mini program.

      var ftModule = uni.requireNativePlugin("GCUniPlugin-MobileAgent");
        ftModule.appendBridgeContext({
                    'wgt_id': 'wgt_id_1'
                });
    

SDK Initialization

Basic Configuration

// Configure in App.vue
<script>
    var ftModule = uni.requireNativePlugin("GCUniPlugin-MobileAgent");
    export default {
        onLaunch: function() {
            ftModule.sdkConfig({
                'datakitUrl': 'your datakitUrl',
                'debug': true,
                'env': 'common',
                'globalContext': {
                    'custom_key': 'custom value'
                }
            })
        }
    }
</script>
<style>
</style>
Parameter Name Parameter Type Required Description
datakitUrl string Yes Local environment deployment (Datakit) reporting URL address, example: http://10.0.0.1:9529, port defaults to 9529, the device installing the SDK needs to be able to access this address. Note: Only one of datakitUrl and datawayUrl should be configured
datawayUrl string Yes Public Dataway reporting URL address, obtained from the [User Access Monitoring] application, example: https://open.dataway.url, the device installing the SDK needs to be able to access this address. Note: Only one of datakitUrl and datawayUrl should be configured
clientToken string Yes Authentication token, needs to be used together with datawayUrl
debug boolean No Set whether to allow printing Debug logs, default false
env string No Environment, default prod, any character, it is recommended to use a single word, such as test, etc.
service string No Set the name of the business or service to which it belongs, default: df_rum_ios, df_rum_android
globalContext object No Add custom tags
offlinePakcage boolean No Only supported on Android, whether to use offline packaging or uni mini program, default false, detailed description see Difference between Android Cloud Packaging and Offline Packaging
autoSync boolean No Whether to automatically sync data to the server after collection. Default YES. When NO, use the flushSyncData method to manage data synchronization manually
syncPageSize number No Set the number of entries for sync requests. Range [5,). Note: The larger the number of request entries, the more computing resources the data synchronization will occupy, default is 10
syncSleepTime number No Set the sync interval time. Range [0,5000], default is not set
enableDataIntegerCompatible boolean No It is recommended to enable this when coexisting with web data. This configuration is used to handle web data type storage compatibility issues. Enabled by default in versions 0.2.1 and above
compressIntakeRequests boolean No Compress the upload sync data with deflate, default is off, supported in SDK 0.2.0 and above
enableLimitWithDbSize boolean No Enable using db to limit data size, default 100MB, unit Byte, the larger the database, the greater the disk pressure, default is off.
Note: After enabling, the Log configuration logCacheLimitCount and RUM configuration rumCacheLimitCount will become invalid. Supported in SDK 0.2.0 and above
dbCacheLimit number No DB cache limit size. Range [30MB,), default 100MB, unit byte, supported in SDK 0.2.0 and above
dbDiscardStrategy string No Set the data discard rules in the database.
Discard strategy: discard discard new data (default), discardOldest discard old data. Supported in SDK 0.2.0 and above
dataModifier object No Modify a single field. Supported in SDK 0.2.2 and above, usage example can be found here
lineDataModifier object No Modify a single piece of data. Supported in SDK 0.2.2 and above, usage example can be found here

RUM Configuration

var rum = uni.requireNativePlugin("GCUniPlugin-RUM");
rum.setConfig({
  'androidAppId':'YOUR_ANDROID_APP_ID',
  'iOSAppId':'YOUR_IOS_APP_ID',
  'errorMonitorType':'all', // or 'errorMonitorType':['battery','memory']
  'deviceMonitorType':['cpu','memory']// or  'deviceMonitorType':'all'
})
Parameter Name Parameter Type Required Description
androidAppId string Yes appId, applied in monitoring
iOSAppId string Yes appId, applied in monitoring
samplerate number No Sampling rate, range [0,1], 0 means no collection, 1 means full collection, default value is 1. Scope is all View, Action, LongTask, Error data under the same session_id
sessionOnErrorSampleRate number No Set the error collection rate, when the session is not sampled by samplerate, if an error occurs during the session, data from 1 minute before the error can be collected, range [0,1], 0 means no collection, 1 means full collection, default value is 0. Scope is all View, Action, LongTask, Error data under the same session_id. Supported in SDK 0.2.2 and above
enableNativeUserAction boolean No Whether to track Native Action, Button click events, pure uni-app applications are recommended to turn off, default false, Android cloud packaging is not supported
enableNativeUserResource boolean No Whether to track Native Resource automatically, default false, Android cloud packaging is not supported. Since uniapp's network requests on iOS are implemented using system APIs, after enabling, all resource data on iOS can be collected together, please disable manual collection on iOS at this time to prevent duplicate data collection.
enableNativeUserView boolean No Whether to track Native View automatically, pure uni-app applications are recommended to turn off, default false
errorMonitorType string/array No Error monitoring supplementary types: all, battery, memory, cpu, default is not set
deviceMonitorType string/array No Page monitoring supplementary types: all, battery (only supported on Android), memory, cpu, fps, default is not set
detectFrequency string No Page monitoring frequency: normal(default), frequent, rare
globalContext object No Custom global parameters, special key: track_id (used for tracking function)
enableResourceHostIP boolean No Whether to collect the IP address of the request target domain name. Scope: only affects the default collection when enableNativeUserResource is true. iOS: >= iOS 13 is supported. Android: Single Okhttp has an IP cache mechanism for the same domain name, the same OkhttpClient, if the server IP does not change, it will only be generated once.
enableTrackNativeCrash boolean No Whether to enable Android Java Crash and OC/C/C++ crash monitoring, default `false
enableTrackNativeAppANR boolean No Whether to enable Native ANR monitoring, default false
enableTrackNativeFreeze boolean No Whether to collect Native Freeze
nativeFreezeDurationMs number No Set the threshold for collecting Native Freeze stutters, range [100,), unit milliseconds. iOS default 250ms, Android default 1000ms
rumDiscardStrategy string No Discard strategy: discard discard new data (default), discardOldest discard old data
rumCacheLimitCount number No Local cache maximum RUM entry count limit [10_000,), default 100_000

Log Configuration

var logger = uni.requireNativePlugin("GCUniPlugin-Logger");
logger.setConfig({
  'enableLinkRumData':true,
  'enableCustomLog':true,
  'discardStrategy':'discardOldest'
})
Parameter Name Parameter Type Required Description
samplerate number No Sampling rate, range [0,1], 0 means no collection, 1 means full collection, default value is 1.
enableLinkRumData boolean No Whether to link with RUM
enableCustomLog boolean No Whether to enable custom logs
discardStrategy string No Log discard strategy: discard discard new data (default), discardOldest discard old data
logLevelFilters array No Log level filtering, the array needs to be filled with log levels: info prompt, warning warning, error error, critical, ok recovery
globalContext object No Custom global parameters
logCacheLimitCount number No Local cache maximum log entry count limit [1000,), the larger the log, the greater the disk cache pressure, default 5000

Trace Configuration

var tracer = uni.requireNativePlugin("GCUniPlugin-Tracer");
tracer.setConfig({
  'traceType': 'ddTrace'
})
Parameter Name Parameter Type Required Description
samplerate number No Sampling rate, range [0,1], 0 means no collection, 1 means full collection, default value is 1.
traceType string No Trace type: ddTrace (default), zipkinMultiHeader, zipkinSingleHeader, traceparent, skywalking, jaeger
enableLinkRUMData boolean No Whether to link with RUM data, default false
enableNativeAutoTrace boolean No Whether to enable native network auto-tracing iOS NSURLSession, Android OKhttp, default false, Android cloud packaging is not supported. Since uniapp's network requests on iOS are implemented using system APIs, after enabling, network requests initiated by uniapp on iOS can be automatically traced, please disable manual trace on iOS at this time to prevent trace and RUM data linkage errors.

RUM User Data Tracking

var rum = uni.requireNativePlugin("GCUniPlugin-RUM");

Action

API - startAction

Start RUM Action.

RUM will bind the Resource, Error, LongTask events that this Action may trigger. Avoid adding multiple times within 0.1 s, the same View will only be associated with one Action at the same time, if the previous Action has not ended, the new Action will be discarded. It does not affect the Action added by the addAction method.

rum.startAction({
  'actionName': 'action name',
  'actionType': 'action type'
})
Parameter Name Parameter Type Required Description
actionName string Yes Event name
actionType string Yes Event type
property object No Event context (optional)

API - addAction

Add Action event. This type of data cannot be linked to Error, Resource, LongTask data, and there is no discard logic.

rum.addAction({
  'actionName': 'action name',
  'actionType': 'action type'
})
Parameter Name Parameter Type Required Description
actionName string Yes Event name
actionType string Yes Event type
property object No Event context (optional)

View

  • Automatic Collection

Method 1: Only need to set App.vue and the first page the application enters. Refer to the example project of the GCUniPlugin plugin in the SDK package Hbuilder_Example/App.vue, Hbuilder_Example/pages/index/index.vue

// step 1. Locally add GC-JSPlugin to your project's uni_modules directory
// step 2. Add Router monitoring in App.vue as follows:
<script>
  import {gcWatchRouter} from '@/uni_modules/GC-JSPlugin';
  export default {
    mixins:[gcWatchRouter], //<--- Notice
  }
</script>
// step 3. Add pageMixin to the first page displayed by the application as follows
<script>
  import {gcPageMixin} from '@/uni_modules/GC-JSPlugin';
  export default {
    data() {
      return {}
    },
    mixins:[gcPageMixin], //<--- Notice
  }
</script>

Method 2: Apply to each page that needs to be monitored, needs to be used separately from GCWatchRouter.js. Refer to the example project of the GCUniPlugin plugin in the SDK package Hbuilder_Example/pages/rum/index.vue

// Locally add GC-JSPlugin to your project's uni_modules directory
<script>
import  {gcPageViewMixinOnly} from '@/uni_modules/GC-JSPlugin';
export default {
    data() {
        return {            
        }
    },
    mixins:[gcPageViewMixinOnly], //<--- Notice
    methods: {}
}
</script>
  • Manual Collection
// Manually collect View lifecycle
// step 1 (optional)
rum.onCreateView({
  'viewName': 'Current Page Name',
  'loadTime': 100000000,
})
// step 2
rum.startView('Current Page Name')
// step 3  
rum.stopView()         

API - onCreateView

Create page load time record

Field Type Required Description
viewName string Yes Page name
loadTime number Yes Page load time (nanosecond level timestamp)

API - startView

Enter page

Field Type Required Description
viewName string Yes Page name
property object No Event context (optional)

API - stopView

Leave page

Field Type Required Description
property object No Event context (optional)

Error

  • Automatic Collection
// Locally add GC-JSPlugin to your project's uni_modules directory
import { gcErrorTracking } from '@/uni_modules/GC-JSPlugin'
gcErrorTracking.startTracking()
  • Manual Collection
// Manually add
rum.addError({
  'message': 'Error message',
  'stack': 'Error stack',
})

API - addError

Add Error event

Field Type Required Description
message string Yes Error message
stack string Yes Stack information
state string No App running state (unknown, startup, run)
type string No Error type, default uniapp_crash
property object No Event context (optional)

Resource

  • Automatic Collection

The SDK provides the calling method gcRequest.request, which inherits the network request method of uni.request, and can replace uni.request for use.

Replacement Method

+ import {gcRequest} from '@/uni_modules/GC-JSPlugin';
- uni.request({
+ gcRequest.request({
  //...
});

Usage Example

// Locally add GC-JSPlugin to your project's uni_modules directory
 import {gcRequest} from '@/uni_modules/GC-JSPlugin';
gcRequest.request({
  url: requestUrl,
  method: method,
  header: header,
  filterPlatform:["ios"], 
  timeout:30000,
  success(res)  {
    console.log('success:' + JSON.stringify(res))
  },
  fail(err) {
    console.log('fail:' + JSON.stringify(err))
  },
  complete() {
    console.log('complete:' + JSON.stringify(err))
  }
});

Additional Field Type Required Description
filterPlatform array No When the enableNativeUserResource function is enabled, uniapp on iOS will automatically collect network request data initiated through system APIs. To avoid duplicate data collection, you can add the filterPlatform: ["ios"] parameter when using gc.request to disable manual data collection on the iOS platform.
  • Manual Collection

Manually call startResource, stopResource, addResource to implement, you can refer to the implementation of GCRequest.js

API - startResource

HTTP request start

Field Type Required Description
key string Yes Request unique identifier
property object No Event context (optional)

API - stopResource

HTTP request end

Field Type Required Description
key string Yes Request unique identifier
property object No Event context (optional)

API - addResource

Parameter Name Parameter Type Required Description
key string Yes Request unique identifier
content content object Yes Request related data

content object

Prototype Parameter Type Description
url string Request url
httpMethod string HTTP method
requestHeader object Request header
responseHeader object Response header
responseBody string Response result
resourceStatus string Request result status code

Logger Log Printing

var logger = uni.requireNativePlugin("GCUniPlugin-Logger");
logger.logging({
  'content':`Log content`,
  'status':status
})

API - logging

Field Type Required Description
content string Yes Log content, can be a json string
status string Yes Log level
property object No Event context (optional)

Log Levels

String Meaning
info Info
warning Warning
error Error
critical Critical
ok Ok

Tracer Network Trace

  • Automatic Collection

Use the gc.request method for request calls, and Propagation Header will be automatically added, refer to Resource

  • Manual Collection
//Example using uni.request for network requests
var tracer = uni.requireNativePlugin("GCUniPlugin-Tracer");
let key = Utils.getUUID();//Refer to Hbuilder_Example/utils.js
var header = tracer.getTraceHeader({
      'key': key,
      'url': requestUrl,
})
uni.request({
        url: requestUrl,
        header: header,
        success() {

        },
        complete() {

        }
});

API - getTraceHeader

Get the request header needed for trace, and add it to the HTTP request header.

Field Type Required Description
key string Yes Request unique identifier
url string Yes Request URL

Return Type: object

User Information Binding and Unbinding

var ftModule = uni.requireNativePlugin("GCUniPlugin-MobileAgent");
ftModule.bindRUMUserData({
  'userId':'Test userId',
  'userName':'Test name',
  'userEmail':'test@123.com',
  'extra':{
    'age':'20'
  }
})

ftModule.unbindRUMUserData()

API - bindRUMUserData

Bind user information:

Field Type Required Description
userId string Yes User Id
userName string No User name
userEmail string No User email
extra object No User's additional information

API - unbindRUMUserData

Unbind the current user.

Shut Down SDK

var ftModule = uni.requireNativePlugin("GCUniPlugin-MobileAgent");
ftModule.shutDown()

API - shutDown

Shut down the SDK.

Clear SDK Cache Data

var ftModule = uni.requireNativePlugin("GCUniPlugin-MobileAgent");
ftModule.clearAllData()

API - clearAllData

Clear all data that has not been uploaded to the server.

Active Data Sync

var ftModule = uni.requireNativePlugin("GCUniPlugin-MobileAgent");
ftModule.flushSyncData()

API - flushSyncData

When configuring sdkConfig.autoSync as true, no additional operation is needed, the SDK will automatically sync.

When configuring sdkConfig.autoSync as false, you need to actively trigger the data sync method to sync data.

WebView Data Monitoring

WebView data monitoring requires integrating the Web Monitoring SDK in the WebView access page.

Android only supports offline packaging and uni mini program

Data Masking

If you want to fully mask a field, it is recommended to use dataModifier, which performs better. If you need detailed rule replacement, it is recommended to use lineDataModifier.

Single Field Modification (dataModifier)

  • Function: Modify a single field value in the data

  • Parameter format: {key: newValue}

  • Example: {'device_uuid': 'xxx'} will replace the device_uuid field value in the target data with "xxx"

Single Data Modification (lineDataModifier)

  • Function: Modify the specified field value in a certain type of data

  • Parameter format: {measurement: {key: newValue}}

  • Example: {'view': {'view_url': 'xxx'}} will modify the view_url field value in all view type data to "xxx"
  • measurement data type list:
  • RUM data: view, resource, action, long_task, error
  • Log data: log
 var ftModule = uni.requireNativePlugin("GCUniPlugin-MobileAgent"); 
  ftModule.sdkConfig({
                 datakitUrl: 'your datakitUrl',
                 debug: true,
         dataModifier: { 'device_uuid':'xxx'},
         lineDataModifier:{ 'resource' :{'response_header':'xxx'},
                            'view' :{'view_url':'xxx'},
    } 
    })

Add Custom Tags

var ftModule = uni.requireNativePlugin("GCUniPlugin-MobileAgent");
ftModule.appendGlobalContext({
          'ft_global_key':'ft_global_value'
})
ftModule.appendRUMGlobalContext({
          'ft_global_rum_key':'ft_global_rum_value'
})
ftModule.appendLogGlobalContext({
          'ft_global_log_key':'ft_global_log_value'
})                

API - appendGlobalContext

Add custom global parameters. Applies to RUM, Log data

Field Type Required Description
None object Yes Custom global parameters

API - appendRUMGlobalContext

Add custom RUM global parameters. Applies to RUM data

Field Type Required Description
None object Yes Custom global RUM parameters

API - appendLogGlobalContext

Add custom Log global parameters. Applies to Log data

Field Type Required Description
None object Yes Custom global Log parameters

Add BridgeContext

Supported in SDK 0.2.4 and above

 var ftModule = uni.requireNativePlugin("GCUniPlugin-MobileAgent");
 ftModule.appendBridgeContext({
            'ft_bridge_context': 'ft_bridge_context_value'
    });

API - appendBridgeContext

Only inject RUM and log data collected by UniApp, data collected by Native is not injected.

Purpose: Distinguish data sources or mark specific scenarios.

Field Type Required Description
None object Yes UniApp environment parameters

Frequently Asked Questions

Plugin Development iOS Main Project UniPlugin-iOS Usage

Download UniApp Offline Development SDK

According to the version number of the uni-app development tool HBuilderX, download the SDK package required for developing the plugin.

SDK package structure description

|--iOSSDK   
    |-- HBuilder-Hello              // uni-app offline packaging project
    |-- HBuilder-uniPluginDemo      // uni-app plugin development main project (the project needed for this document)
    |-- SDK                         // Dependency library and dependency resource files

Drag the dependency library and dependency resource files SDK folder into the UniPlugin-iOS folder, the directory structure after dragging should be as follows.

|-- UniPlugin-iOS
    |-- HBuilder-uniPluginDemo      // uni-app plugin development main project (the project needed for this document)
    |-- SDK                         // Dependency library and dependency resource files

For more details, refer to iOS Plugin Development Environment Configuration.

Project Configuration

1.Architectures Setting

Because the simulator provided by Xcode 12 supports the arm64 architecture, the framework provided by uni_app supports arm64 real machine and x86_64 simulator. So

Set Excluded Architectures to Any iOS Simulator SDK: arm64.

2.Other Linker Flags

$(inherited) -ObjC -framework "FTMobileSDK" -framework "GC_UniPlugin_App"

3.Framework Search Paths

$(inherited)
"${PODS_CONFIGURATION_BUILD_DIR}/FTMobileSDK"
"${PODS_CONFIGURATION_BUILD_DIR}/GC-UniPlugin-App"
$(DEVELOPER_FRAMEWORKS_DIR)
$(PROJECT_DIR)/../SDK/libs
$(PROJECT_DIR)

Plugin Development Android Main Project UniPlugin-Android Usage

Project Configuration

For detailed dependency configuration, refer to Demo. For more Gradle extension parameter configuration, refer to Android SDK

|-- UniPlugin-Android
    |-- app
        |--build.gradle
        // ---> Configure ft-plugin
        // apply:'ft-plugin'

    |-- uniplugin_module
        |-- src
            |-- main
                |-- java
                    |-- com.ft.sdk.uniapp
        |-- build.gradle 
        //---> Configure dependencies dependencies
        //implementation 'com.cloudcare.ft.mobile.sdk.tracker.agent:ft-sdk:xxxx'
        //implementation 'com.google.code.gson:gson:xxxx'
        //implementation 'com.cloudcare.ft.mobile.sdk.tracker.agent:ft-native:xxxx'

    |-- build.gradle
        //---> Configure repo
        //  maven {
        //          url 'https://mvnrepo.jiagouyun.com/repository/maven-releases'
        //  }
        //
        //--> Configure buildScrpit
        //  classpath 'com.cloudcare.ft.mobile.sdk.tracker.plugin:ft-plugin:xxxx'

Difference between Android Cloud Packaging and Offline Packaging

Android cloud packaging and offline packaging use two different integration logics. Offline packaging integration method is the same as Guance Android SDK integration method, using Android Studio Gradle Plugin method, cloud packaging cannot use Android Studio Gradle Plugin, so it can only be implemented through the internal code of Guance UniApp Native Plugin for some functions. Therefore, the offline packaging version has more configurable options than the cloud packaging version, the offlinePakcageparameter in the SDK configuration is used to distinguish the two situations.

Others

Feedback

Is this page helpful? ×