tencent cloud

Feedback

SDK Quick Integration

Last updated: 2024-08-06 16:28:18
    Sample code for integration.
    Download stable versions of tcmpp_flutter.

    Prerequisites

    Environment requirements

    sdk: '>=3.0.0 <4.0.0'
    flutter: '>=3.3.0'

    Plugin dependencies

    plugin_platform_interface
    flutter_plugin_android_lifecycle

    Integration method

    Adding TCMPP core plugins dependency

    1. Depend on it: Open the pubspec.yaml file located inside the app folder, and add tcmpp_flutter: ${version} under dependencies.
    
    2. Install it:
    From the terminal: Run flutter pub get.
    From VS Code: Click Get Packages located in right side of the action ribbon at the top of pubspec.yaml indicated by the Download icon.
    From Android Studio/IntelliJ: Click Pub get in the action ribbon at the top of pubspec.yaml.

    Obtaining the configuration file

    To initialize the mini program SDK, first obtain the SDK configuration file from the mini program console.
    Log in to the console, and click Create application.
    
    In the pop-up window, fill in the app information. In the integration platform section, check both the iOS and Android platforms. Enter the bundle ID or application ID in the package name field.
    
    Click Next to download the Android/iOS configuration files. 
    

    Adding the configuration file

    1. Place the TCMPP configuration file in the Flutter project.
    2. Add a file named tcmpp-plugin-settings.json in the root directory of the project.
    3. Edit the pubspec.yaml file to include the above files as a Flutter resource.
    In the tcmpp-plugin-settings.json file, you can configure the SDK settings as needed.
    Android:
    Field
    Type
    Description
    configAssetsName
    string
    Path to TCMPP configuration file in Android
    debug
    bool
    Enable SDK debugging and logging
    enableX5Core
    bool
    Use TBS service (X5 core) as the mini program runtime
    x5LicenseKey
    string
    TBS license if the runtime is enabled
    X5DocLicenseKey
    string
    TBS documentation license if the runtime is enabled
    x5Core32Url
    string
    The download address of the 32-bit TBS runtime
    x5Core64Url
    string
    The download address of the 64-bit TBS runtime
    iOS:
    Field
    Type
    Description
    configAssetsName
    string
    Path to TCMPP configuration file in iOS
    debug
    bool
    Enable SDK debugging
    logEnable
    bool
    Enable SDK logging
    inspectableEnabled
    bool
    Enable inspectable feature for iOS 16.4 and later, allowing mini program debugging via Safari
    General:
    Field
    Type
    Description
    appName
    string
    Host app name, mainly for copyright notices in the mini program
    appVersion
    string
    Host app version, mainly for copyright notices in the mini program
    Sample
    {
    "android": {
    "configAssetsName": "tcmpp-android-configurations.json",
    "debug": true,
    "enableX5Core": true,
    "x5LicenseKey": "",
    "x5DocLicenseKey": "",
    "x5Core32Url": "",
    "x5Core64Url": ""
    },
    "ios": {
    "configAssetsName": "tcmpp-ios-configurations.json",
    "debug": true,
    "logEnable": true,
    "inspectableEnabled": true
    },
    "common":{
    "appName": "tcmpp-flutter",
    "appVersion": "1.0.0"
    }
    }
    In Android, go to android > app > build.gradle in your Flutter project, and the applicationId can be found in android > defaultConfig.
    
    In iOS, go to ios > Runner.xcodeproj > project.pbxproj in your Flutter project, and search for PRODUCT_BUNDLE_IDENTIFIER.
    

    Platform-specific

    For Android

    1. Go to android > app, and edit the build.gradle file.
    2. In the android > defaultConfig section, set minSdkVersion to at least 21.
    
    minSdkVersion 21
    3. In the android > defaultConfig section, add packagingOptions.
    
    packagingOptions {
    pickFirst 'lib/arm64-v8a/libc++_shared.so'
    pickFirst 'lib/armeabi/libc++_shared.so'
    pickFirst 'lib/armeabi-v7a/libc++_shared.so'
    pickFirst 'lib/arm64-v8a/libmarsxlog.so'
    pickFirst 'lib/armeabi/libmarsxlog.so'
    pickFirst 'lib/armeabi-v7a/libmarsxlog.so'
    pickFirst 'lib/arm64-v8a/libv8jni.so'
    }

    For iOS

    Adding the source code

    Add the source code in the Podfile located in the ios directory.
    source 'https://e.coding.net/tcmpp-work/tcmpp/tcmpp-repo.git'

    Running pod install

    Run pod install by navigating to the iOS directory and executing the command.
    pod install
    

    Opening the mini program

    Run the command to import the TCMPP API: import 'package:tcmpp_flutter/tcmpp_flutter.dart'.
    
    Create a TcmppFlutter object and call the TCMPP API with the object to open the mini program.
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support