Capacitor SDK Integration
Before you startMake sure you've obtained a token, server URL, and auth key from credolab Customer Success Manager.
The minimal supported Capacitor version is 4 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 is15.0or higher
1. Install dependencies
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/Important: Always exclude .npmrc files from version control (e.g., add them to .gitignore). These files may contain sensitive authentication tokens or private registry credentials that should never be committed to the repository.
Install the plugins to your project
npm install @credolab/[email protected]
NotePlease replace
X.Y.Zwith module versions from Cordova SDK page.
The final result should look like this:npm install @credolab/[email protected]
Add repositories for Android
Open android\build.gradle file and declare the repository:
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\App\Podfile file
source 'https://token:[email protected]/basic/credolab/proxyen-sdk/cocoapods/index.git'Sync project by running the following command
npx cap sync
Unable to find a specification forlibrary_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 Podfilesource 'https://cdn.cocoapods.org/'
2. Build and Use CredoAppService
CredoAppServiceIn your Capacitor app code, open the file whereCredoAppService planned to be used.
Add plugins import
BuildCredoAppService with required modules
const service = new CredoAppService()
await service.addModuleAsync(new IosCalendarEventsModule())
await service.addModuleAsync(new IosCalendarRemindersModule())
await service.addModuleAsync(new IosContactModule())
await service.addModuleAsync(new IosMediaModule())
await service.addModuleAsync(new IosMusicModule())
await service.addModuleAsync(new AndroidVideoModule())
await service.addModuleAsync(new AndroidImagesModule())
await service.addModuleAsync(new AndroidAudioModule())
await service.addModuleAsync(new AndroidAccountModule())
await service.addModuleAsync(new AndroidCalendarModule())
await service.addModuleAsync(new AndroidContactModule())
await service.addModuleAsync(new AndroidTelephonyModule())Call CredoAppService.collectAsync() method to start the data collection process
const dataset = await service.collectAsync()
NoteRelevant 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.
4. Upload collected dataset (Testing purposes only)
Direct Upload Note:In a production environment, datasets should only be uploaded via your organization's proxy server.
For testing, integration, or generating insights, you may use the following code snippet:
Next Steps
After successfully integrating our SDK, it is recommended to proceed with the following steps to utilise our platform effectively:
- Setting up your Reverse Proxy
- Uploading your Dataset. Once the server is configured, you can upload your dataset using the server address.
- 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.
Updated 2 days ago
