Documentation

SDK Integration(Flutter)

Overview

Android

  • Minimum Android version:4.4 (API Level:19)
  • Compilation Android SDK version:API Level:35
  • 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.4.4
  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

      source 'https://github.com/advance-ai-mobile/aai-specs.git'
      source 'https://cdn.cocoapods.org/'
      
      target 'Runner' do
        pod 'SolutionH5', '1.4.4'
      end
    3. run pod install --repo-update

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() {
          final result = await SolutionPlugin.startByUrl(
              "url"); // The url you obtained from your server.
          if (result.terminated) {
            // The flow was terminated. You can provide a corresponding prompt based on result.getCode().
          } else {
            if (result.code == "FINISH") {
              // The flow finished normally. Process the result.
              Map<dynamic, dynamic>? extraInfo = result.extraInfo;
              if (extraInfo != null &&
                  extraInfo['submissionStatus'] != null &&
                  extraInfo['submissionStatus'].toString().toUpperCase() ==
                      'SUBMITTED') {
                // KYC data was submitted successfully.
              } else {
                // Submission failed. At this point, you can get an error code from extraInfo
                // and implement other logic based on the code, such as re-selecting a document.
              }
            } else {
              // This branch currently only handles the USER_GIVE_UP case.
            }
          }
          print("result code = ${result.code}");
          print("result signatureId = ${result.signatureId}");
          print("result finishRedirectUrl = ${result.finishRedirectUrl}");
          print("result terminated = ${result.terminated}");
          print("result extraInfo = ${result.extraInfo}");      
      }
    }

    For detailed return values, please consult the [documentation link].

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

Release Notes

Click to show release notes