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 SDKimport com.preventor.pvtidentityverification.PreventorSDKclassMainActivity : AppCompatActivity() {overridefunonCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)setContentView(R.layout.activity_main)// 2. Set the context to parameters "activity" and "ViewModelStoreOwner"val preventorSDK =PreventorSDK(this, this) }}
packagecom.preventor.example;// 1. Add import of Preventor SDKimportcom.preventor.pvtidentityverification.PreventorSDK;publicclassMainActivityextendsAppCompatActivity { @OverrideprotectedvoidonCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);// 2. Set the context to parameters "activity" and "ViewModelStoreOwner"PreventorSDK preventorSDK =newPreventorSDK(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.exampleimport com.preventor.pvtidentityverification.PreventorSDKclassMainActivity : AppCompatActivity() {overridefunonCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)setContentView(R.layout.activity_main)val preventorSDK =PreventorSDK(this, this)// 1. GET CONFIG OBJECT val config = preventorSDK.getConfig() }}
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:
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.
When the ticket ends in the following combinations, flowStatus and dispositionStatus respectively:
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
cifcode
The cifcode is the unique customer profile code.
ticketId
The ticketId is the unique code of the verification.