Use the following code snippet to receive SDK callbacks
VIDVOCRListener vidvOcrListener= new VIDVOCRListener() {
@Override
public void onOCRResult(VIDVOCRResponse response) {
if (response instanceof Success) {
//an example code to use the response in your app :
String firstName = ((Success) response).getData().getOcrResult().getFirstName();
//firstName variable will hold the first name of the scanned National ID
// Add your own code
} else if (response instanceof CapturedImages) {
// Add your own code
} else if (response instanceof UserExit) {
// Add your own code
} else if (response instanceof ServiceFailure) {
// Add your own code
} else if (response instanceof BuilderError) {
// Add your own code
}
}
};
Response Instances
Success : Process finished successfully
CapturedImages: Images captured are returned in real-time
Note: ForCapturedImagesinstance, images are not processed yet
BuilderError : Process terminated due to an error in the builder
Note: Check your configurations
ServiceFailure : Process finished with the user's failure to pass the service requirements
UserExit : Process terminated by the user with no errors
Primary Response Object
VIDVOCRResult
Note: This is the first-level object that contains all the second-level objects.
It is present in these type of response and holds data related to the responses, includingSuccess,ServiceFailure, and UserExit.
Here is the attributes of VIDVOCRResultclass that represents the data that could be retrived from the response object VIDVOCRResponse using getData() method that returnsVIDVOCRResultobject like in the example code above showing a use of Success response.