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

Integration

The minimal supported version of React Native is 0.60.0 or higher
The minimal supported iOS version is 11.0 or higher
The minimal supported Android API version is 21 or higher

🚧

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

1. Declare dependencies

Add dependency to your project in the package.json file:

"dependencies": {
    "@credolab/react-core": "X.Y.Z",
  
    "@credolab/react-android-application": "X.Y.Z",
    "@credolab/react-android-account": "X.Y.Z",
    "@credolab/react-android-audio": "X.Y.Z",
    "@credolab/react-android-calendar": "X.Y.Z",
    "@credolab/react-android-contact": "X.Y.Z",
    "@credolab/react-android-images": "X.Y.Z",
    "@credolab/react-android-iovation": "X.Y.Z",
    "@credolab/react-android-sms": "X.Y.Z",
    "@credolab/react-android-video": "X.Y.Z",
  
    "@credolab/react-ios-calendar-events": "X.Y.Z",
    "@credolab/react-ios-calendar-reminders": "X.Y.Z",
    "@credolab/react-ios-contact": "X.Y.Z",
    "@credolab/react-ios-iovation": "X.Y.Z",
    "@credolab/react-ios-media": "X.Y.Z",
    "@credolab/react-ios-music": "X.Y.Z",
  }

⚠️

Note

Please replace X.Y.Z with module versions from React Native SDK page.
The final result should look like this:

	"@credolab/react-core": "5.0.0"

Add .npmrc file at the root level of the project with the path to the plugin repository

@credolab:registry=https://npm.cloudsmith.io/credolab/hybrid/

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

npm install

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://token:[email protected]/basic/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/'

Install Pods

Install pods by executing

pod install

2. Build and Use CredoAppService

In your React Native app code open the file where theCredoAppService planned to be used.

Add plugins import

import CredoAppService from '@credolab/react-core';
import AndroidApplicationModule from '@credolab/react-android-application';
import AndroidCalendarModule from '@credolab/react-android-calendar';
import AndroidContactModule from '@credolab/react-android-contact';
import AndroidAccountModule from '@credolab/react-android-account';
import AndroidImagesModule from '@credolab/react-android-images';
import AndroidIovationModule from '@credolab/react-android-iovation';
import AndroidAudioModule from '@credolab/react-android-audio';
import AndroidVideoModule from '@credolab/react-android-video';
import AndroidSmsModule from '@credolab/react-android-sms';

import IosMusicModule from '@credolab/react-ios-music';
import IosCalendarEventsModule from '@credolab/react-ios-calendar-events';
import IosCalendarRemindersModule from '@credolab/react-ios-calendar-reminders';
import IosContactModule from '@credolab/react-ios-contact';
import IosIovationModule from '@credolab/react-ios-iovation';
import IosMediaModule from '@credolab/react-ios-media';

Build CredoAppService with required modules

var service = new CredoAppService()
await service.addModuleAsync(new AndroidApplicationModule())
await service.addModuleAsync(new AndroidCalendarModule())
await service.addModuleAsync(new AndroidContactModule())
await service.addModuleAsync(new AndroidAccountModule())
await service.addModuleAsync(new AndroidImagesModule())
await service.addModuleAsync(new AndroidIovationModule())
await service.addModuleAsync(new AndroidAudioModule())
await service.addModuleAsync(new AndroidVideoModule())
await service.addModuleAsync(new AndroidSmsModule())

await service.addModuleAsync(new IosMusicModule())
await service.addModuleAsync(new IosCalendarEventsModule())
await service.addModuleAsync(new IosCalendarRemindersModule())
await service.addModuleAsync(new IosMediaModule())
await service.addModuleAsync(new IosIovationModule())
await service.addModuleAsync(new IosContactModule())

Call collectAsync() method to start the data collection process

await service.collectAsync()

πŸ“˜

Note

Relevant for Android only
Add functionality for requesting permissions before starting the data collection process in case there are used modules that require granting dangerous permissions. The detailed info about modules can be found here.

Done!

3. Run an App

To run an app on an Android device:

react-native run-android

To run app on an iOS device:

react-native run-ios

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.