Documentation

SDK Integration(Flutter)

Overview

Android

  • Minimum Android version:4.4 (API Level:19)
  • Compilation Android SDK version:API Level:34
  • Supported CPU architectures:armeabi-v7aarm64-v8a
  • SDK incremental package size: ~0.9MB
  • Use-permissions:
    <uses-feature android:name="android.hardware.camera" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA" />

iOS

  • Minimum iOS version: iOS 12.0
  • Supported CPU architectures: arm64
  • SDK incremental package size: ~0.7M
  • Use-permissions: NSCameraUsageDescription

pub.dev dependency

  1. Add pub spec.yaml dependency

    dependencies:
      solution_plugin: ^1.2.0 
  2. For the iOS platform,the following configurations need to be added:

    1. Add camera usage description in Info.plistas below. Ignore this step if you have added those

      <key>NSCameraUsageDescription</key>  
      <string>Use the camera to detect the face movements</string>
    2. Add the following code to the podfile file in your project

      target 'Runner' do
        flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
      
        pod 'SolutionH5', :http => 'https://prod-guardian-cv.oss-ap-southeast-5.aliyuncs.com/sdk/iOS-Solution-SDK/1.2.0/iOS-SolutionH5-V1.2.0.tar.bz2', type: :tbz
      
      end

Quick Start

  1. Declare the plugin.

    import 'package:solution_plugin_alpha/env.dart';
    import 'package:solution_plugin_alpha/region.dart';
    import 'package:solution_plugin_alpha/solution_plugin.dart';
    import 'package:solution_plugin_alpha/solution_result.dart';
  2. Get the SDK version number.

    SolutionPlugin.getSDKVersion.then((sdkVersion) {
        print(sdkVersion);
    });
  3. Start a h5 page.

    // Sample code
    class _SomePageState extends State<SomePage> {
    
      ...
     
      void start() {
        SolutionPlugin.startByUrl(
          "url", // The url you obtained from your server.
          ).then((value) => {
              print("solution result: " + value.toString()),// sample value:  {"code": "FINISH","signatureId": "6f1188513f30c827"}
            });
      }
    }
    

Offline Resource(Only Android)

We have packaged the HTML resources into the assets directory of Android and bundled them into an SDK. When integrating this SDK, the resources in the H5 page will be prioritized from the local device, which improves the loading speed of the HTML.

To integrate this SDK, please add the following dependency in your flutterProject/android/build.gradle file:

implementation 'ai.advance.mobile-sdk.android:solution-web-resource:1.8.12'

The version number here only refers to the version of the HTML functionality, and is unrelated to the SolutionSDK itself.Please make sure to update to the latest version of the offline resource SDK as soon as possible. If not updated, some H5 resources may still be loaded from the remote server instead of being fully retrieved from the local assets directory.

Language Support

Currently, the SDK supports the following languages:

  • English
  • Indonesian // coming soon
  • Chinese //coming soon