Android
To install the Preventor Android SDK, add the following to your project’s
build.gradle
file:- 1.Use minSdkVersion 23 in your
build.gradle (Module:app)
- 2.Add implementation
'com.preventor:preventor_sdk:2.0.73-alpha'
to your dependencies. - 3.Add repository depencencies in your
build.gradle (Project Settings)
- 4.In your
build.gradle (Project: app)
. Make sure you have the same version or higher"org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
plugin. - 5.In your
gradle.properties (Project Properties)
add this lineandroid.enableJetifier=true
A complete
build.gradle
file should look similar to the example below.android {
// 1. Ensure you have hat least minSdkVersion 23
compileSdkVersion 32
defaultConfig {
applicationId "com.preventor.example"
minSdkVersion 23
targetSdkVersion 32
versionCode 1
versionName "1.0.0"
}
}
dependencies {
...
// 2. Add line here
implementation 'com.preventor:preventor_sdk:2.0.10-alpha'
}
// 3.
repositories {
jcenter()
maven { url "https://jitpack.io" }
maven { url 'https://button.preventor.com/__android/v2'}
}
You have successfully installed the Preventor SDK!
Initialize the SDK. See the coding example below:
Kotlin
Java
package com.preventor.example
// 1. Add import of Preventor SDK
import com.preventor.pvtidentityverification.PreventorSDK
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// 2. Set the context to parameters "activity" and "ViewModelStoreOwner"
val preventorSDK = PreventorSDK(this, this)
}
}
package com.preventor.example;
// 1. Add import of Preventor SDK
import com.preventor.pvtidentityverification.PreventorSDK;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// 2. Set the context to parameters "activity" and "ViewModelStoreOwner"
PreventorSDK preventorSDK = new PreventorSDK(this,this);
}
}
You have successfully initialize the Preventor SDK!
To continue with the integration you need to set the prefill shown below. First you must obtain the config object by calling
getConfig()
method.kotlin
Java
package com.preventor.example
import com.preventor.pvtidentityverification.PreventorSDK
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val preventorSDK = PreventorSDK(this, this)
// 1. GET CONFIG OBJECT
val config = preventorSDK.getConfig()
}
}
package com.preventor.example;
import com.preventor.pvtidentityverification.PreventorSDK;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
PreventorSDK preventorSDK = new PreventorSDK(this,this);
// 1. GET CONFIG OBJECT
Config config = preventorSDK.getConfig();
}
}
The flow type defines the biometric process so you must select a flow type.
Kotlin
Java
package com.preventor.example
import com.preventor.pvtidentityverification.PreventorSDK
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
preventorSDK = PreventorSDK(this, this)
val config = preventorSDK.getConfig()
// 1. SET THE FLOW TYPE
config.flowId = "YOUR_FLOW_ID"
}
}
package com.preventor.example;
import com.preventor.pvtidentityverification.PreventorSDK;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
PreventorSDK preventorSDK = new PreventorSDK(this,this);
Config config = preventorSDK.getConfig();
// 1. SET THE FLOW TYPE
config.setFlowId("YOUR_FLOW_ID");
}
}
You must assign the flow type code. If it is blank, it will take the flow type by default.
You must set all credentials values to correctly consume our services.
Kotlin
Java
package com.preventor.example
import com.preventor.pvtidentityverification.PreventorSDK
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
preventorSDK = PreventorSDK(this, this)
val config = preventorSDK.getConfig()