You have successfully installed the Preventor SDK!
2. Initialize the SDK
Initialize the SDK. See the coding example below:
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!
3. Prefilling configs
To continue with the integration you need to set the prefill shown below. First you must obtain the config object by calling getConfig() method.
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();
}
}
Prefill Flowtype
The flow type defines the biometric process so you must select a flow type.
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.
Prefill Credentials
You must set all credentials values to correctly consume our services.
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()
config.flowId= "YOUR_FLOW_ID"
// 2. SET THE CREDENTIALS
config.credentials.apiKey = "YOUR_API_KEY"
config.credentials.clientSecret = "YOUR_CLIENT_SECRET"
config.credentials.tenant = "YOUR_TENANT"
config.credentials.banknu = "YOUR_BANKNU"
config.credentials.env = "YOUR_ENV"
}
}
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();
config.setFlowId("YOUR_FLOW_ID");
// 2. SET THE CREDENTIALS
config.getCredentials().setApiKey("YOUR_API_KEY");
config.getCredentials().setClientSecret("YOUR_CLIENT_SECRET");
config.getCredentials().setTenant("YOUR_TENANT");
config.getCredentials().setBanknu("YOUR_BANKNU");
config.getCredentials().setEnv("YOUR_ENV");
}
}
Value
Description
YOUR_API_KEY
your provided apikey.
YOUR_CLIENT_SECRET
your provided clientsecret.
YOUR_TENANT
your provided tenant.
YOUR_BANKNU
your provided banknu.
YOUR_ENV
your provided env.
Prefill Cif Code
The Cifcode is the unique customer profile code.
If the Cifcode is empty, a unique code is assigned.
To start verification you can also use this call validateApiKey() anywhere in your code when all necessary resources have already been completed.
5. Handling Verifications
To find out if a user has completed the verification process, canceled it or there was an error. To do this, you can implement the following delegate / callback methods:
Method
Description
onStart
This callback method is triggered once a user starts the verification flow.
onSubmitted
Method that is being called once verification data is submitted to Preventor.
onFinish
Method that is being called once a user clicks the "Finish" button.
onError
This callback method fires when a user canceled the verification flow, the verification ended with an error, or the user performed an incorrect process. You can use this to find out the reason for the error.
Error codes:
CANCELLED_BY_USER
BIOMETRIC_AUTHENTICATION_FAILED
BAD_STEP_BY_USER
MISSING_PARAMETERS
TIME_OUT
onNextStep
This callback indicates that it is possible to proceed to the next verification
onComplete
This callback indicates that all necessary resources have already been completed
Should look similar to the example below.
preventorSDK.callback(object : PreventorSDKListener {
override fun onStart() {
println("MainActivity onStart");
}
override fun onFinish(ticked: Ticked) {
println("MainActivity onFinish");
}
override fun onError(error: String) {
println("MainActivity onError: $error");
}
override fun onSubmitted(ticked: Ticked) {
println("MainActivity onSubmitted");
}
override fun onNextStep() {
println("MainActivity onNextStep");
}
override fun onComplete() {
println("MainActivity onComplete");
}
})
When the verification is finished it will return a ticked object in which you can see the results of the verification. Within them take as reference cifcode, ticketId, flowStatus, dispositionStatus.
Result
Value
cifcode
The cifcode is the unique customer profile code.
ticketId
The ticketId is the unique code of the verification.