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:

dependencies:
  flutter_core: 
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_core
    version: 6.3.0
  flutter_android_account:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_android_account
    version: 6.0.0
  flutter_android_application:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_android_application
    version: 6.0.0
  flutter_android_contact:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_android_contact
    version: 6.1.0  
  flutter_android_calendar:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_android_calendar
    version: 6.0.0  
  flutter_android_audio:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_android_audio
    version: 6.0.0
  flutter_android_video:
    hosted:
    	url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_android_video
    version: 6.0.0
  flutter_android_images:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_android_images
    version: 6.0.0
  flutter_android_iovation:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_android_iovation
    version: 6.0.0
  flutter_android_sms:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_android_sms
    version: 6.0.0
  flutter_android_calllog:
    hosted:
    	url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_android_calllog
    version: 6.0.0

    
  flutter_ios_contact:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_ios_contact
    version: 5.0.0
  flutter_ios_calendar_events:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_ios_calendar_events
    version: 5.0.0
  flutter_ios_calendar_reminders:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_ios_calendar_reminders
    version: 5.0.0
  flutter_ios_media:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_ios_media
    version: 5.1.0
  flutter_ios_music:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_ios_music
    version: 5.0.0
  flutter_ios_iovation:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_ios_iovation
    version: 6.0.0
  flutter_behavioral:
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_behavioral
    version: 6.0.0

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_application/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';
import 'package:flutter_android_iovation/module.dart';
import 'package:flutter_android_sms/module.dart';
import 'package:flutter_android_calllog/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_iovation/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(false);
  service.setIgnorePermissions(false);

  // add modules
  await service.addModule(AndroidVideoModule());
  await service.addModule(AndroidApplicationModule());
  await service.addModule(AndroidCalendarModule());
  await service.addModule(AndroidContactModule());
  await service.addModule(AndroidImagesModule());
  await service.addModule(AndroidAudioModule());
  await service.addModule(AndroidIovationModule());
  await service.addModule(AndroidAccountModule());
  await service.addModule(AndroidSmsModule());
  await service.addModule(AndroidCallLogModule());
  
  await service.addModule(IosContactModule());
  await service.addModule(IosCalendarEventsModule());
  await service.addModule(IosCalendarRemindersModule());
  await service.addModule(IosMusicModule());
  await service.addModule(IosMediaModule());
  await service.addModule(IosIovationModule());

  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.

  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.