Global IQA SDK Flutter plugin Integration Guide

Overview

Android

iOS

If you previously integrated using the source code method, please switch to dependency integration and refer to the migration document.

pub.dev dependency

  1. Add pub spec.yaml dependency

  2. For the Android platform,set the largeHeap property to true (strongly recommended)

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

    2. Add the spec source to the podfile file in your project

3. Run pod install --repo-update

Quick Start

  1. Declare the plugin.

  2. Initialize the SDK.

  3. Get the SDK version number.

  4. Check license

    The license is obtained by your server calling our openAPI, you need to check license before starting the IQA activity.

  5. User binding (highly recommended).

    You can use this method to pass us your unique user ID, and we will establish a mapping relationship based on that ID. It's easy to track logs with us in case of problems.

  6. Start and Get Results

    We provide two ways to get images and detection results, you can get them directly through the SDK or you can request the results via IDVID.

Advanced iOS Customization

1. Setting the Interface Language

You can set the SDK's display language by passing a language parameter. If this parameter is omitted, the SDK will default to the current system language.

Supported Language Codes:

2. Overriding Specific Text Strings

The SDK allows you to override any default text string for any supported language. This is useful for customizing specific labels, messages, or buttons to better match your app's tone.

Steps:

  1. Find the Text Key: All available keys can be found in the following file within your Xcode project:

  2. Construct the Override Map: Create a Map<String, dynamic> where each key is a composite string in the format {language_code}.{text_key} and the value is your custom text.

  3. Pass the Parameter: Add this map to the startGlobalIQC method using the localizedStrs parameter.

Example:

3. Using a Custom Font

You can apply a custom font to all text within the SDK to maintain a consistent brand identity.

Steps:

  1. Add Font File to Your Xcode Project:

    • Drag and drop your custom font file (e.g., MyCustomFont.ttf) into your main iOS project in Xcode.
    • In the "Add to targets" dialog, ensure your main app target is selected.
  2. Register the Font in Info.plist:

    • Open your project's Info.plist file.
    • Add a new key named Fonts provided by application (raw key: UIAppFonts).
    • This key should be an array. Add a new string item to this array with the full name of your font file.
  3. Pass the Font Name Parameter:

    • Add the fontName parameter to the startGlobalIQC method. The value should be the PostScript name of the font (which may differ from the file name).

    Note: To find the correct PostScript name, open the font file on your Mac with the "Font Book" application and check its info panel.

4. Overriding Default Images

The SDK allows you to replace its default icons and images with your own custom assets.

Steps:

  1. Find the Image Name: All default image names can be found by browsing the asset catalog located at:

  2. Prepare Your Custom Image:

    • Your custom image file must be named with an aai_ prefix. For example, if you want to replace the default iqa_scan_successfully image, your new file should be named aai_iqa_scan_successfully.
    • This naming convention prevents conflicts with your app's other assets.
  3. Add Image to Your Project's Assets:

    • Drag and drop your custom image (e.g., aai_iqa_scan_successfully.png) into your main app's primary asset catalog (Assets.xcassets).

How it Works:

The SDK will automatically detect your custom images. For any given image, it first looks for an asset with the aai_{imageName} naming convention in your main project's asset catalog.

Advanced Android Customization

1. Specifying a Single Language

If your app only supports one language and does not require multi-language support, you can add the following configuration in your_flutter_project/android/app/build.gradle:

Since the default language of the SDK is English, meaning the values directory contains English resources, you need to copy the language resources from the values-in-rID folder to the values directory to replace the English resources.

2. Overriding Specific Text Strings

You can customize the SDK's text strings by adding or modifying the strings.xml file in the corresponding language resource directory under your_flutter_project/android/app/src/main/res/. The SDK supports the following languages:

DirectoryLanguage
valuesEnglish (Default)
values-in-rIDIndonesian
values-th-rTHThai
values-zhChinese

For example, to customize English strings, edit your_flutter_project/android/app/src/main/res/values/strings.xml. To customize Indonesian strings, edit your_flutter_project/android/app/src/main/res/values-in-rID/strings.xml, and so on for other languages.

Change the value to whatever text you want to display. Below is the full list of customizable string keys (shown with English defaults):

3. Using a Custom Font

Place your custom font file (e.g., my_font.ttf, the file name can be anything) in the your_flutter_project/android/app/src/main/res/font directory. Then add the following theme configuration in your_flutter_project/android/app/src/main/res/values/themes.xml:

This will change the font of the IQA pages to the font you specified.

4. Overriding Default Images and Backgrounds

You can replace the SDK's default images and backgrounds by adding files with the same name to the your_flutter_project/android/app/src/main/res/drawable directory. The following files can be overridden: