These docs are for v2.6. Click to read the latest docs for v3.2.

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 thepubspec.yaml:

dependencies:
  flutter_core: 
    hosted:
      url: https://dart.cloudsmith.io/credolab/hybrid/
      name: flutter_core
    version: 6.0.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.0.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_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.0.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

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_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';
  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(IosContactModule());
  await service.addModule(IosCalendarEventsModule());
  await service.addModule(IosCalendarRemindersModule());
  await service.addModule(IosMusicModule());
  await service.addModule(IosMediaModule());
  await service.addModule(IosIovationModule());

  // 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
  }
}
  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. With the dataset uploaded, you can now get insights.

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