API Reference
中文

Flutter

Only supports Android and iOS

Integrated Requirement

Compliance Explanation

Please note that when integrating SDK products provided by the TrustDecision in the APP of your company:

1.1 According to the user's information protection regulations, before your users start the App for the first time and start collecting information, your company should fully inform the user of the purpose, method, and scope of collecting, using, and sharing the user's personal information with a third party through an interactive interface or design (such as a pop-up window of the privacy policy), and obtain the express consent of the end user.

1.2 To provide business security and risk control services to your company, the TrustDecision SDK will collect, process, and use the identification information(IMEI/IDFA), AndroidID, IMSI, MEID, MAC address, SIM card serial number, device type, device model, system type, geographical location, login IP address, application list, running process, sensor information(light sensor, gravity sensor, magnetic field sensor, acceleration sensor, gyroscope sensor) and other device information of the user's device. To ensure compliance with your use of related services, the aforementioned privacy policy should cover the authorization of TrustDecision SDK to provide services and collect, process, and use relevant information. The following terms are for your reference. The specific expression can be determined by your company according to the overall framework and content of your privacy agreement:

TrustDecision SDK: For business security and risk control, our company uses the TrustDecision SDK. The SDK needs to obtain the information of your devices, such as (IMEI/IDFA), AndroidID, IMSI, MAC address, SIM card serial number, device type, device model, system type, geographic location, login IP address, application list, running process, sensor information(light sensor, gravity sensor, magnetic field sensor, acceleration sensor, gyroscope sensor) and other related device information, for fraud risk identification.

Privacy Protocol: https://www.trustdecision.com/legal/privacy-policy

Environment

AndroidiOS
Supported System VersionsAndroid 5.0 and aboveiOS 9.0 and above
Supported Architecturesarmeabi, armeabi-v7a, arm64-v8a, x86armv7,arm64,x86_64

Integrate

Install

Plugin Install

Add trustdevice_pro_plugin to pubspec.yaml of your project.

dependencies:
  flutter:
    sdk: flutter
  ...
  trustdevice_pro_plugin: ^1.3.1

AndroidManifest.xml

Declare the following permissions in the AndroidManifest.xml file under the application module

<manifest>
   <!-- required -->
   <uses-permission android:name="android.permission.INTERNET"/>
   <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
   <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
  <!-- Outside the Chinese Mainland -->
  <uses-permission android:name="com.google.android.gms.permission.AD_ID"/>

   <!--optional, If not declared, some device information will be abandoned -->
   <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
   <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
   <uses-permission android:name="android.permission.READ_PHONE_STATE" />
   <!-- required for Android 11 and above to obtain the installed packages -->
   <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
        tools:ignore="QueryAllPackagesPermission" />
</manifest>

Permissions

NameDescription
INTERNET(required)Allows the app to access the network connection and send requests to communicate with the server.
ACCESS_NETWORK_STATE(required)Collect network connection status information.
ACCESS_WIFI_STATE(required)Collect the current WiFi access status and WLAN hotspot information.
AD_ID(required)Collect the Google advertising ID, required outside the Chinese Mainland.
ACCESS_COARSE_LOCATIONGet location information, with an accuracy of approximately 30 to 1500 meters.
ACCESS_FINE_LOCATIONGet location information, with positioning accuracy within 10 meters.
READ_PHONE_STATECollect information on SIM card
QUERY_ALL_PACKAGESCollect installed packages

Initialization

Cautions

  • Ensure that it is initialized after the user agrees to the privacy agreement.

Definition

  Future<void> initWithOptions(Map<String, dynamic> config)

Get blackBox

Cautions

  • Call getBlackBox after initWithOptions.
  • Don't cache blackBox returned by getBlackBox in the app. Please rely on this function to get blackBox.

Definition

  // get by synchronous call 
  Future<String> getBlackBox()
  // get by asynchronous call
  Future<String> getBlackBoxAsync();

Best Practices

  1. Call initialization in the onCreate method of the application, and obtain blackBox asynchronously
import 'package:trustdevice_pro_plugin/trustdevice_pro_plugin.dart';

class _MyAppState extends State<MyApp> {
  final _trustdeviceProPlugin = TrustdeviceProPlugin();
  
  @override
  void initState() {
    super.initState();
    _initWithOptions();
  }
  
  Future<void> _initWithOptions() async {
     var options = {
      "partner": "",
      "appKey": "",
      "appName": "",
      "country": ""
    };
    //Anti debugging switch, used during development phase
 		options["debug"] = true;
    _trustdeviceProPlugin.initWithOptions(options);
    var blackBox = await _trustdeviceProPlugin.getBlackBoxAsync();
    print("_initWithOptions blackBox: ${blackBox}");
  }
  
}
  1. Obtain blackBox in actual business scenarios
Future<void> _register() async {
   var blackBox = await _trustdeviceProPlugin.getBlackBox();
   // ...
}

Status Check

  1. getBlackBox() will return a 26-bit string while initialization successfully: rGPGX1678775227I9NCwcuVJCb
  2. getBlackBox() will return a string of around 5000 bits while initialization Failed, please refer to overview-definition

Other

Get SDK Version

  Future<String> getSDKVersion()

Keep Configuration

-keep class cn.tongdun.**{*;}
-keep class com.trustdecision.**{*;}

All Configuration

KeyDescription平台SampleRemove Field
partner(required)Partner code, contact operator to obtain.Alloptions["partner"] = "your partner"
appKey(required)Application identification, please refer tohow to get appKeyAlloptions["appKey"] = "your appKey"
country(required)Data-center: cn for China fra for Europe sg for Singapore inda for Indonesia us for the USAAlloptions["country"] = "your country"
appNameApplication name, contact operator to obtainAlloptions["appName"] = "your appName"
debugAllow debugging, default false, must be closed before the application release.Alloptions["debug"] = true
timeLimitNetwork timeout configuration, in seconds, default 15sAlloptions["timeLimit"] = 5
locationwhether collecting GPS location information, default allowedAlloptions["location"] = truelatitude、longitude、gps_location
collectLevelYou can set M to control the maximum length of blackBox to 2000, default around 5000Alloptions["collectLevel"] = "M"
IDFAWhether collecting IDFA information, default allowediOSoptions["IDFA"] = trueidfa
deviceNameWhether collecting device name, default allowediOSoptions["deviceName"] = truedevice_name
runningTasksWhether collecting running tasks, default allowedAndroidoptions["runningTasks"] = truerunning_packages
sensorWhether collecting sensor information, default allowedAndroidoptions["sensor"] = truemangetic_field_sensor、gyroscope_sensor、light_sensor、accelerator_data、gravity_data
readPhoneWhether collecting READ PHONE STATE permission-related information, default allowedAndroidoptions["readPhone"] = truecountry_iso、carrier、network_operator、sim_operator、phone_type、radio_type、device_svn
installPackageListWhether collecting application list information, default allowedAndroidoptions["installPackageList"] = trueinstalled_packages