Integration

The minimal supported version of Flutter SDK is 2.12(inclusive) or higher
The minimal supported version of Flutter is 1.20.0(inclusive) or higher
The minimal supported iOS version is 11.0 or higher

🚧

If iOS Iovation plugin is used then the minimum supported iOS version is 12.0 or higher

The minimal supported Android API version is 21 or higher

1. Declare dependencies

Add dependency to your project in the pubspec.yaml . Replace X.Y.Z with the actual plugin version:

dependencies:
  flutter_core: 
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_core
    version: X.Y.Z
  flutter_android_account:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_android_account
    version: X.Y.Z
  flutter_android_contact:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_android_contact
    version: X.Y.Z  
  flutter_android_calendar:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_android_calendar
    version: X.Y.Z  
  flutter_android_audio:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_android_audio
    version: X.Y.Z
  flutter_android_video:
    hosted:
    	url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_android_video
    version: X.Y.Z
  flutter_android_images:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_android_images
    version: X.Y.Z
  # Please note that if the Core plugin (flutter_core) version 6.4.0 or higher is used, 
  # there is no need to include the Application plugin
  #  flutter_android_application:
  #    hosted:
  #      url: https://dart.cloudsmith.io/credolab/hybrid/
  #      name: flutter_android_application
  #    version: X.Y.Z
    
  flutter_ios_contact:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_ios_contact
    version: X.Y.Z
  flutter_ios_calendar_events:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_ios_calendar_events
    version: X.Y.Z
  flutter_ios_calendar_reminders:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_ios_calendar_reminders
    version: X.Y.Z
  flutter_ios_media:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_ios_media
    version: X.Y.Z
  flutter_ios_music:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_ios_music
    version: X.Y.Z
  flutter_ios_application:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_ios_application
    version: X.Y.Z
  flutter_behavioral:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_behavioral
    version: X.Y.Z

Open a terminal window on the root path of your project and execute:

flutter pub get

Add repositories for Android

Open android/build.gradle file and add the repository according to your flow:

allprojects {
    repositories {
        // ...
        maven { url "https://dl.cloudsmith.io/$TOKEN/credolab/proxyen-sdk/maven/" }
    }
}

Add repositories for iOS

Add the Cocoapods repository to the beginning of the ios/Podfile file

source 'https://dl.cloudsmith.io/$TOKEN/credolab/proxyen-sdk/cocoapods/index.git'

📘

Unable to find a specification for library_name?

In certain cases you may see the error with similar title during pods installation.
To fix this, please add the following CocoaPods CDN to the Podfile

source 'https://cdn.cocoapods.org/'

2. Build and Use CredoAppService

In your Flutter code open the file where theCredoAppService planned to be used.

  1. Add plugin import
import 'package:flutter_core/credo_app_service.dart';

import 'package:flutter_android_account/module.dart';
import 'package:flutter_android_audio/module.dart';
import 'package:flutter_android_video/module.dart';
import 'package:flutter_android_images/module.dart';
import 'package:flutter_android_calendar/module.dart';
import 'package:flutter_android_contact/module.dart';

// Please note that if the Core plugin (flutter_core) version 6.4.0 or higher is used, 
// there is no need to include the Application plugin
// import 'package:flutter_android_application/module.dart';

import 'package:flutter_ios_contact/module.dart';
import 'package:flutter_ios_calendar_reminders/module.dart';
import 'package:flutter_ios_calendar_events/module.dart';
import 'package:flutter_ios_music/module.dart';
import 'package:flutter_ios_media/module.dart';
import 'package:flutter_ios_application/module.dart';

import 'package:flutter_behavioral/module.dart';
import 'package:flutter_behavioral/behavioral/credoapp_behavioral.dart';
  1. Call addModule(MODULE_NAME) to add the particular module and callcollect() method to start the data collection process
Future<void> collectData() async {
  // init CredoAppService
  var service = CredoAppService();
  service.setForceResolvePermissions(true);
  service.setIgnorePermissions(false);

  // add modules
  await service.addModule(AndroidVideoModule());
  await service.addModule(AndroidCalendarModule());
  await service.addModule(AndroidContactModule());
  await service.addModule(AndroidImagesModule());
  await service.addModule(AndroidAudioModule());
  await service.addModule(AndroidAccountModule());
  
  await service.addModule(IosContactModule());
  await service.addModule(IosCalendarEventsModule());
  await service.addModule(IosCalendarRemindersModule());
  await service.addModule(IosMusicModule());
  await service.addModule(IosMediaModule());
  await service.addModule(IosApplicationModule());
  
  await service.addModule(BehavioralModule());
  
  // collect data
  final result = await service.collect();
  
 	if(result.isFailure){  
  	print("Error: ${result.code} ${result.message}");  
 	}else{  
	 	result.value // this is dataset -> now upload collected data to credolab servers
  }
}

// If the BehavioralModule is included, then wrap the root app widget with the CredoAppBehavioral widget
void main() {
  runApp(CredoAppBehavioral(
      key: Key("root_layout"),
      startTracking: true, // To start behavioral data tracking, or initiate tracking process anywhere in your app by calling BehavioralModule.startTracking(); method
      child: const MyApp()));
}

📘

Note - Behavioral module

Please refer to BehavioralModule section for additional information about module integration.

🚧

Note - Application module

To integarte IosApplicationModule module, the initial step involves adding URL Schemas into the Info.plist file within your project (maximum 50 schemas are allowed).

Please refer to the native module intagration where the default list is specified.

  1. Done!

Next Steps

After successfully integrating our SDK, it is recommended to proceed with the following steps to utilise our platform effectively:

  1. Setting up your Reverse Proxy
  2. Uploading your Dataset. Once the server is configured, you can upload your dataset using the server address.
  3. Collecting your Dataset Insight or TruValidate(formerly known as iovation) Fraud Check. With the dataset uploaded, you can now get insights or perform TruValidate Fraud Checks to assess risk based on the device and transaction details provided.

If you have any further questions, please do not hesitate to contact us.