Android Dynamic SDK Integration
Sample Project
You can find the sample project for a complete Android Integration in dynamic mode.
If you require more control over the journey and order of the steps or show custom screens between ID verification steps, you can use IDWise SDK in dynamic mode. This mode allows you to start specific steps and for you application to regain control after each step. Please note this integration mode requires more code and responsibility on your side.
For an overview for end to end sequence diagram refer to Dynamic SDK Integration Overview.
Starting a new journey in dynamic mode
First ensure you have added the android SDK dependency and initialize the SDK as in Step 1 and Step 2.
Once the SDK is initialized, it becomes ready to start an ID verification journey flow. To commence the flow, articulated below methods are offer by SDK to start the journey in dynamic mode:
IDWise.startDynamicJourney(
context,
"<FLOW_ID>", //Provided by IDWise
"<REFERENCE_NUMBER>",
"en",
journeyCallback,
stepCallback
)
This method takes the following parameters:
flowId
: (also called Journey Definition ID): This is a unique identifier that identifies your journey flow. IDWise shares this with you when you register to use IDWise system.referenceNo
: (Optional) This parameter allows you to attach a unique identifier (such as a reference number) with the user undergoing the current journey. It's beneficial for connecting the journey to the user and/or the application that initiated it. You will receive this reference number in the webhook request.locale
: (Optional)This refers to the ISO code representing the desired language for the user interface components. Please reach out to IDWise Support for the list of available languages.IDWiseSDKCallback
: This is an implementation of an interface that consists of various callback events.IDWiseSDKStepCallback
: This is an implementation of an interface that consists of various step callback events.
Starting the Steps
When onJourneyStarted(...)
or onJourneyResumed(...)
are triggered successfully, you can call the IDWise.startStep(...)
to start the specific verification Step.
IDWise.startStep(context, stepId)
This method takes the following parameters:
context
: Activity of FragmentstepId
: ID of the step you want to start. (Will be provided by IDWise for each step)
IDWise.startStepFromFileUpload(context, stepId, byteArray)
Using this method you can also pass a PDF or an Image File as a ByteArray. Important Note:
Size of the byteArray should be less then 6MB. Following is an example
The step events (provided in IDWiseSDKStepCallback parameter provided to startDynamicJourney or resumeDynamicJourney method) will be triggered as step is handled and processed.
Skipping the Step
When onJourneyStarted(...)
or onJourneyResumed(...)
are triggered successfully, you can call the IDWise.skipStep(...)
to skip any verification Step. (Added support from version 4.5.9)
IDWise.skipStep(stepId)
This method takes only one parameter:
stepId
: ID of the step you want to skip. (Will be provided by IDWise for each step)
The step events (provided in IDWiseSDKStepCallback parameter provided to startDynamicJourney or resumeDynamicJourney method) will be triggered as step is skipped.
Journey Callbacks
val journeyCallback = object : IDWiseSDKCallback {
override fun onJourneyStarted(journeyInfo: JourneyInfo) {
Log.d("IDWiseSDKCallback", "onJourneyStarted")
}
override fun onJourneyCompleted(journeyInfo: JourneyInfo,isSucceeded: Boolean) {
Log.d("IDWiseSDKCallback", "onJourneyCompleted")
}
override fun onJourneyResumed(journeyInfo: JourneyInfo) {
Log.d("IDWiseSDKCallback", "onJourneyResumed")
}
override fun onJourneyCancelled(journeyInfo: JourneyInfo?) {
Log.d("IDWiseSDKCallback", "onJourneyCancelled")
}
override fun onError(error: IDWiseSDKError) {
Log.d("IDWiseSDKCallback", "onError ${error.message}")
}
})
Journey callback's usage are articulated below:
onJourneyStarted
: This event is triggered when a user's journey begins. It serves to notify your application that the process has been initiated. Useful for logging or implementing any preparatory actions necessary for the journey.onJourneyResumed
: This event is triggered when a user's journey begins. It serves to notify your application that the process has been initiated. Useful for logging or implementing any preparatory actions necessary for the journey.onJourneyCompleted
: This callback is activated upon the completion of a user's journey. It signifies that the user has successfully navigated through all steps and finished the process. This is typically where you would implement any code required to handle the completion of the journey.onJourneyCancelled
: This is applicable for simple SDK, and not applicable for the dynamic SDK.onError
: This event is invoked when an error occurs at any point during the journey. It allows your application to respond to any unexpected issues, ensuring smooth error handling and user experience. Bellow all possible errors.
Step Callbacks
val stepCallback = object : IDWiseSDKStepCallback {
override fun onStepCaptured(stepId: String, bitmap: Bitmap?, croppedBitmap: Bitmap?) {
//This event triggers when User has captured the image from the camera
}
override fun onStepResult(stepId: String, stepResult: StepResult?) {
//This event is triggered when Image processing is completed at the backend.
//stepResult contains the details of the processing output
Log.d("onStepResult", "Step $stepId result!!")
}
override fun onStepConfirmed(stepId: String) {
Log.d("onStepConfirmed", "Step $stepId confirmed!!")
}
override fun onStepCancelled(stepId: String) {
Log.d("onStepCancelled", "Step $stepId cancelled!!")
}
override fun onStepSkipped(stepId: String) {
Log.d("onStepSkipped", "Step $stepId skipped!!")
}
}
Step callback's usage are articulated below:
onStepCaptured
: This event is triggered when a user's capture an image or select an image from gallery. The purpose of this method is to handle the captured steps images. It's triggered on the confirmation of each step side.onStepResult
: This event is triggered with an outcome after complete of a submission and process. This is typically where you may handle the results of your submitted step. Note that, it's triggered only once for each step considering both front and back side and the outcome for the both sides can be retrieved from the result of the front side.onStepCancelled
: This event is triggered when the User cancels the step and the user is back in your app now.onStepSkipped
: This event is triggered when a step is skipped by callingIDWise.skipStep(...)
method.
StepResult contains following information
Field | Type | Description |
---|---|---|
recognition | DocumentRecognition | Document recognition information |
extractedFields | Map of String and FieldValue | Information extracted from the document such as Name and Birth Date |
hasPassedRules | Boolean | Whether the step passes the validity checks |
isConcluded | Boolean | Whether the user can still retry the step or not |
status | String | Processing status one of (In Progress , Submitted , Not Submitted ) |
errorUserFeedbackCode | String | A code that can be used to indicate the error. All the error feedback codes can be found here. |
errorUserFeedbackDetails | String | details for the error message directed at the user, providing feedback in case an error occurs during the step. |
errorUserFeedbackTitle | String | A title for the error message directed at the user, providing feedback in case an error occurs during the step. |
nfcResult | NFCResult | Result from NFC chip reading |
The DocumentRecognition object contains the following information related to the scanned document.
Field | Type | Description |
---|---|---|
issuingCountryCode | String | Country of issue as ISO 3166-1 alpha-3 country code |
issuingCountryName | String | Name of country of issue |
documentType | String | Type of the Document, either a Identity Card , Passport , Commercial Licence , Driving Licence , Practice Permit , Residence Permit , Utility Bill , Vehicle Licence , Vaccination Card , Work Permit , Car Registration , Travel Document , Car Ownership , Visa , Vehicle Registration , Proof of Address , Other Forms , Insurance Certificate , Birth Certificate , Registration Certificate , Tax Document , National Insurance Document , Military ID , Voter Card , Archive Only . |
The NFCResult object contains the following data extracted from the Document via reading the NFC chip
Field | Type | Description |
---|---|---|
facePhoto | Bitmap | Image of the user which is extracted from NFC chip scanning |
extractedFields | Map of String and FieldValue | Information extracted from the NFC chip scanning |
All extractedFields
from the NFC can be found here
NFC Chip Reading
To enable NFC Chip Reading, special configuration need to be carried out. Please get in touch with IDWise Support for more information.
Get Summary of the Verification Journey
You can get the Status of the journey anytime by calling the following function
IDWise.getJourneySummary() { journeySummary, error ->
// journeySummary contains the status of all steps and overall journey status
}
JourneySummary
contains the following information
Field | Type | Description |
---|---|---|
journeyId | String | A unique identifier for the user journey. |
isCompleted | Boolean | A boolean field that indicates if the journey is completed or not. |
stepSummaries | List of StepSummary | An array of objects that detail the steps the user has gone through in the journey. Each object in this array contains a definition and a result. |
journeyResult | JourneyResult | Result and Status of the verification Journey as described below |
StepSummary
contains the following information
Field | Type | Description |
---|---|---|
definition | StepDefinition | An object that describes the step. |
result | StepResult | An object that contains the result of the step. |
StepDefinition
contains the following information
Field | Type | Description |
---|---|---|
step_id | Int | An identifier for the step within the journey. |
JourneyResult
contains the following information
Field | Type | Description |
---|---|---|
completedSteps | Int | Number of completed steps in the journey |
interimRuleAssessment | InterimRuleAssessment | Enum for the combined Interim rules assessment result [Passed, Failed] |
interimRuleDetails | HashMap<String, RuleDetail> | Hashmap of all the Rules Assessment Results applicable |
RuleDetail
contains the following information
Field | Type | Description |
---|---|---|
name | String | Name of the Rule |
result | Result of the Rule Assessment | Enum for the combined Interim rules assessment result [Passed, Failed, CouldNotApply] |
Error Feedbacks
You can access the table of error feedbacks, which includes descriptions for each of the feedback codes on here
Resuming a dynamic journey
IDWise.resumeDynamicJourney(
context,
"<FLOW_ID>", //Provided by IDWise
"<JOURNEY_ID>",
"en",
journeyCallback,
stepCallback
)
This method takes the following parameters:
flowId
: (also called Journey Definition ID): This is a unique identifier that identifies your journey flow. IDWise shares this with you when you register to use IDWise system.journeyId
: This is a unique identifier that identifies your journey and it can be used to resume. This is received in the implementation ofjourneyCallback
interface inonJourneyStarted
method when you started journey first time.locale
: (Optional)This refers to the ISO code representing the desired language for the user interface components. Please reach out to IDWise Support for the list of available languages.IDWiseSDKCallback
: The implementation of the callback is in the preceding section.IDWiseSDKStepCallback
: The implementation of the callback is in the preceding section.
Finishing a dynamic journey
This method is used to finish the ongoing journey, you can call once all the required the steps are concluded.
IDWise.finishDynamicJourney()
The journey events (provided in IDWiseSDKCallback parameter provided to startDynamicJourney or resumeDynamicJourney method) will be triggered as journey is completed.
Unloading the SDK
You can unload the SDK when it is no longer required to free up the resources
IDWise.unloadSDK()
The journey events (provided in IDWiseSDKCallback parameter provided to startDynamicJourney or resumeDynamicJourney method) will be triggered as journey is completed.
Extracted Fields
Field Name | Available from NFC |
---|---|
Full Name | Yes |
First Name | Yes |
Last Name | Yes |
Birth Date | Yes |
Expiry Date | Yes |
Issue Date | Some ID Documents |
Document Number | Yes |
Issuing Authority | Some ID Documents |
Issuing Country | Yes |
Issuing Country Code | Yes |
Machine Readable Zone | Yes |
Machine Readable Zone Type | Yes |
Nationality | Yes |
Nationality Code | Yes |
Personal Number | Some ID Documents |
Sex | Yes |
Updated about 1 month ago