Cordova SDK Integration
The minimal supported version of Cordova is 6.0.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. 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/
Install the plugins to your project
cordova plugin add @credolab/[email protected]
ionic cordova plugin add @credolab/[email protected]
Note
Please replace
X.Y.Z
with module versions from Cordova SDK page.
The final result should look like this:ionic cordova plugin add @credolab/[email protected]
Add repositories for Android
Open platforms\android\app\repositories.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 platforms/ios/Podfile
file
source 'https://token:[email protected]/basic/credolab/proxyen-sdk/cocoapods/index.git'
Install Pods
Install pods by executing
pod install
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 Podfilesource 'https://cdn.cocoapods.org/'
2. Build and Use CredoAppService
CredoAppService
In your Cordova app code open the file where theCredoAppService
planned to be used.
Add plugins import
declare var CredoAppService: any
declare var AndroidVideoModule: any;
declare var AndroidImagesModule: any;
declare var AndroidAudioModule: any;
declare var AndroidAccountModule: any;
declare var AndroidCalendarModule: any;
declare var AndroidContactModule: any;
// Please note that if the Core plugin (@credolab/cordova-core) version 5.3.0 or higher is used,
// there is no need to include the AndroidApplicationModule plugin
// declare var AndroidApplicationModule: any;
declare var IosCalendarEventsModule: any;
declare var IosCalendarRemindersModule: any;
declare var IosContactModule: any;
declare var IosMusicModule: any;
declare var IosMediaModule: any;
Build CredoAppService
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())
// Please note that if the Core plugin (@credolab/cordova-core) version 5.3.0 or higher is used,
// there is no need to include the AndroidApplicationModule plugin
// await service.addModuleAsync(new AndroidApplicationModule())
Call CredoAppService.collectAsync()
method to start the data collection process
const dataset = 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.
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 3 months ago