tcmpp_flutter 1.5.18 copy "tcmpp_flutter: ^1.5.18" to clipboard
tcmpp_flutter: ^1.5.18 copied to clipboard

Flutter componet for tcmpp

TCMPP Flutter Plugin #

TCMPP Flutter Plugin is a Flutter plugin to provide access for TCMPP SDK in Flutter. For details of TCMPP, see: https://www.tencentcloud.com/products/tcmpp.

Add TCMPP Flutter Plugin #

Add plugin from Pub.dev #

  1. Add dependecy

    To add plugin from pub.dev, open the pubspec.yaml file located inside the app folder, and add tcmpp_flutter: ${version} under dependencies. image-20240422150143401

  2. Install dependecy

  • 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.

For details how to add Flutter plugins or packages, see Use packages & plugins

Add plugin from local dependency #

  1. Unpack TCMPP Flutter plugin in project root directory.

    image-20240419175509810

  2. Edit pubspec.yaml file, add tcmpp_flutter dependency. The path should be relative path of plugin to your project root path.

    image-20240419175911706

Add assets for TCMPP configuration files #

Get TCMPP configuration file from your TCMPP web console #

  1. Get appcation ID / bundle ID of your Android / IOS application.
  • For Android, in your Flutter project, open android > app > build.gradle, application id can be found in android > defaultConfig section.

image-20240422153054592

  • For IOS, in your Flutter project, open ios > Runner.xcodeproj > project.pbxproj, search for PRODUCT_BUNDLE_IDENTIFIER.

image-20240422154058326

  1. Create Flutter Application on TCMPP web console.

    1. Login the Tencent Cloud Mini Program Platform Console and click 'Overview' in the left-hand navigation bar.
    2. On the Overview page, click Access Application.
    3. In the pop-up window for creating an application, fill in informations for your application.
    4. For Intergration platform section, check both IOS platfrom & Android Platform. Then fill application ID / bundle ID you got in the package name field.

    7226c27b-45c6-4e22-8936-d4ed7678cae7

    1. Click next, download Android / IOS configuration file in the new page.

    3e06ebf3-0034-4302-834d-acf91e144bf4

Add configuration file #

  1. Copy TCMPP configuration file to your Flutter project directory.

    image-20240419180148423

  2. Edit pubspec.yaml file and add assets for TCMPP configuration files.

    image-20240419180028108

Platform specific #

For Android platform #

  1. Open android > app directory, edit build.gradle file.

  2. In android > defaultConfig section, change minSdkVersion to no less than 21.

image-20240419181348211

minSdkVersion 21
  1. In android > defaultConfig section, add ndk filter for armeabi, armeabi-v7a, arm64-v8a.

image-20240419181446446

ndk { abiFilters "armeabi", "armeabi-v7a", "arm64-v8a" }
  1. In android > defaultConfig section, add packagingOptions.

image-20240419181539243

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 platform #

Add source

In the Podfile file in the ios directory, add source:

source 'https://e.coding.net/tmf-work/tmf/tmf-repo.git'

Execute pod install

cd to ios directory,execute pod install:

pod install

TCMPP Flutter APIs #

Usage #

  1. To use TCMPP APIs, import 'package:tcmpp_flutter/tcmpp_flutter.dart'.

    image-20240419182106686

  2. Then create a TcmppFlutter object and use it to call TCMPP APIs.

    image-20240419182158294

APIs #

Future<void> startMiniAppWithId(String appId, MiniStartOptions? options)

Start a mini program with given appId

  • appId: The app id of mini program
  • options: Start options of this mini program

Future<void> startMiniAppWithLink(String link, MiniStartOptions? options)

Start a mini program with given link

  • link: The uri link to start
  • options: Start options of this mini program

Future<ScanResult?> scan()

Start a new page to scan for QR codes, returns a ScanResult if found one

Future<List<AppInfo>?> getRecentList()

Get a list of recent opened mini programs

Future<List<AppInfo>?> searchMiniApp(String keyword,
      {int pageIndex = 0, int pageSize = 0})

Search for online mini programs with given keyword

  • keyWord: Keyword of mini program to search
  • pageIndex: Page to return if pageSize has a none-zero value, which means paging is enabled.
  • pageSize: The max size of a page returned by server. When set to 0, paging willl be disabled.

Classes #

MiniStartOptions

class MiniStartOptions {
  /// entry path of mini program
  String? entryPath;

  /// is always update mini program when start
  bool? isForceUpdate;

  /// string param passed to mini program when start
  String? params;
}

ScanResult

class ScanResult {
  /// result string of qrcode or barcode contains
  String? result;

  /// the type of code
  String? scanType;

  /// charset of result string
  String? charset;
}

AppInfo

class AppInfo {
  /// MiniProgram id
  String appId;

  /// MiniProgram type (release, dev, etc.)
  int appVerType;

  /// MiniProgram version
  String version;

  /// MiniProgram name
  String? name;

  /// MiniProgram icon url
  String? iconUrl;

  /// MiniProgram description
  String? appIntro;

  /// Developer of MiniProgram
  String? appDeveloper;

  /// MiniProgram release time
  int time;
}
0
likes
0
pub points
62%
popularity

Publisher

unverified uploader

Flutter componet for tcmpp

Homepage

License

unknown (LICENSE)

Dependencies

flutter, flutter_plugin_android_lifecycle, plugin_platform_interface

More

Packages that depend on tcmpp_flutter