The DeviceConnect SDK enables the collection of anonymized, non-PII data from user devices, ensuring compliance with privacy policies by obtaining explicit user consent before initiating data sync processes.
The Device Connect Flutter SDK supports:
-
Android
- Minimum version: Android 5.0 (API level 21)
- Requirements: Java 8+, AndroidX
⚠️ To ensure compatibility with Android 7.0 and below, make sure to enable core library desugaring in your Gradle configuration.
-
iOS
- Minimum version: iOS 14.0
android {
...
defaultConfig {
...
// Minimum 5.0+ devices
minSdkVersion(21)
...
}
...
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled = true
// Sets Java compatibility to Java 8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
// For Kotlin projects
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.1.5")
}android {
...
defaultConfig {
...
// Minimum 5.0+ devices
minSdkVersion 21
...
}
...
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// For Kotlin projects
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
}Specify the following in local.properties file:
ACCESS_KEY=<ACCESS_KEY>
SECRET_KEY=<SECRET_KEY>
DC_SDK_VERSION=<DC_ANDROID_SDK_VERSION>
DC_FLAVOR=<DC_FLAVOR>
COMMON_SDK_VERSION=<COMMON_SDK_VERSION>
COMMON_FLAVOR=<COMMON_FLAVOR>
LOGGER_SDK_VERSION=<LOGGER_SDK_VERSION>Specify the following in xcode.env file:
ACCESS_KEY=<ACCESS_KEY>
SECRET_KEY=<SECRET_KEY>
DC_SDK_VERSION=<DC_IOS_SDK_VERSION>Add plugin dependency in pubspec.yaml file:
finbox_dc_plugin: any::: warning NOTE Following will be shared by FinBox team at the time of integration:
ACCESS_KEYSECRET_KEYDC_ANDROID_SDK_VERSIONDC_IOS_SDK_VERSIONDC_FLAVORCOMMON_SDK_VERSIONCOMMON_FLAVORLOGGER_SDK_VERSIONCLIENT_API_KEY:::
To create a user, call the createUser method with the following arguments:
- Client API Key
- Customer ID
::: danger IMPORTANT
CUSTOMER_IDMust be alphanumeric (no special characters).- Should not exceed 64 characters.
- Must not be
nullor an empty string"". :::
FinBoxDcPlugin.createUser("CLIENT_API_KEY", "CUSTOMER_ID").fold(
(left) => {
// Authentication failed
print("Error Code $left")
},
(right) => {
// Authentication is success
print("Access Token: $right")
});You can read about the errors in the Error Codes section.
The startPeriodicSync method should be invoked only after receiving a successful response from the createUser method callback. This method initiates background syncing for all data sources based on the permissions granted by the user. Data is synced at regular intervals in the background, ensuring continuous and seamless data collection.
FinBoxDcPlugin.startPeriodicSync();::: tip RECOMMENDATION To handle cross-login scenarios:
When a user logs back into the app with fresh credentials:
- Call the
createUsermethod to register the new user. - Follow it by
startPeriodicSyncto resume data syncing for the new user. Even though the SDK automatically adapts to a new user, this approach minimizes potential delays in syncing during the first session :::
Device matching enables additional pattern recognition to match email, phone numbers and name. The matching happens on the device and the user phone numbers, email addresses won't leave the device.
Call setDeviceMatch method before starting the syncs.
FinBoxDcPlugin.setDeviceMatch("useremail@gmail.com", "Full Name", "9999999999");Certain phone manufacturers, implement aggressive battery optimization features that kill apps running in the background after a certain period of inactivity. This can prevent the DeviceConnect SDK's continuous syncing from functioning properly, as it relies on background data collection. In such cases, FinBox’s server may need to request data from the SDK when continuous sync has stopped.
To enable this functionality, we use Firebase Cloud Messaging (FCM) notifications process. Forwarding these notifications allows the app to "wake up" if it has been killed by the device’s background processes, ensuring continuous data collection. When the app receives an FCM notification, it "wakes up" and continues collecting the necessary data for integration.
Add the following lines inside FirebaseMessaging.onMessage.listen method.
FinBoxDcPlugin.forwardFinBoxNotificationToSDK(event.data);DeviceConnect uses a content provider to auto initialize the SDK. The limitation with the OS is that content providers are only initialized once in a multi-process application and from the main process. For this reason, any calls to the SDK from other processes will lead to unstable behavior.
In case, you want to use the Flutter SDK from a process other than the main process, follow the two steps mentioned below to initialize the SDK.
Remove the content provider that auto initializes the SDK from the Android Manifest file.
<provider
android:name="in.finbox.mobileriskmanager.init.AutoInitProvider"
android:authorities="in.finbox.lenderapplication.riskmanagerprovider"
android:enabled="true"
android:exported="false"
tools:node="remove" />Initialize the FinBox Flutter SDK in the onCreate method of FlutterApplication class.
FinBoxDcPlugin.initLibrary(this)Make sure to cancel data synchronization tasks when the user logs out of the app by using the stopPeriodicSync method. This ensures that no background sync operations continue unnecessarily, maintaining data security.
FinBoxDcPlugin.stopPeriodicSync();By default sync frequency is set to 8 hours, you can modify it by passing preferred time in seconds as an argument to setSyncFrequency method once the user is created.
FinBoxDcPlugin.setSyncFrequency(12 * 60 * 60);If you need to clear a user's data stored on the device and initiate a fresh data sync, use the resetData method. This ensures that all previous data is removed, and syncing starts from scratch.
FinBoxDcPlugin.resetData();If a user requests to be forgotten, use the forgetUser method. This will delete all user details from our system, ensuring this meets digital guidelines for right to be forgotten.
FinBoxDcPlugin.forgetUser();::: tip RECOMMENDATION
- When a user logs out, call both
stopPeriodicSyncandresetDatato:- Stop any ongoing periodic sync processes.
- Clear existing user data. This approach ensures a clean state before the next user session. :::