Detect and scan a document in two different calls
Overview
In the Getting Started guide, a way of performing both detection and scanning with a single call was shown. However, if your use case requires separating these two actions (for example, to display an intermediate confirmation screen before sending the image to the server), you can perform a two-step scan.
In order to perform these actions, you should have previously called the initAPI method and the startScan method to obtain a scanId. If you have not done this yet, please visit the Getting Started guide.
First, launch the document detection step:
MobbScanAPI.getInstance()
.detectDocument(documentSide) { result, resultData, error -> TODO("Place here your code") }
MobbScanAPI.getInstance().detectDocument(documentSide, (result, resultData, error) -> {
// TODO Place your code here
});
Then you can choose to start the scan as soon as you receive the detection event or save the image and use it later.
MobbScanAPI.getInstance().scanDocument(
documentSide, scanId, detectedImage
) { result, resultData, error -> TODO("Place here your code") }
MobbScanAPI.getInstance()
.scanDocument(documentSide, scanId, detectedBitmap,
(result, resultData, error) -> {
// TODO Place your code here
});
