BlinkID / blinkid-ui-android

Customizable UI library that includes camera management, scanning screen, and document selection module.
35 stars 10 forks source link

Scan timeout configuration #60

Closed samirpramanik closed 5 years ago

samirpramanik commented 5 years ago

Hi,

Earlier, we used the following snippet to achieve timeout handling for our scan activity that extends BaseDocumentScanActivity : protected open fun createScanTimeoutHandler() : ScanTimeoutHandler = DefaultScanTimeoutHandler(SCAN_TIMEOUT_MILLIS); protected open fun createScanTimeoutListener() = createDefaultScanTimeoutListener() Now we are using an activity that implements RecognizerRunnerFragment.ScanningOverlayBinder for card screen. We are using uiSettings = new BlinkCardUISettings(mRecognizerBundle); scanningOverlay = new BlinkCardOverlayController(uiSettings, scanResultListener); for scanning card. So, how can we achieve the timeout handling so that we can perform some operation on timeout.

matvidako commented 5 years ago

Hi,

you can use mRecognizerBundle.setNumMsBeforeTimeout(). Note that this timeout works differently than the one in BlinkID UI, it will start the timer when card number is read. We'll be changing it to start when the card is detected in the next update.

If you need a different behaviour, you could just implement your own timer.

samirpramanik commented 5 years ago

Hi,

Do we have a listener/callback for this timeout? We wish to implement something upon timeout. Is it possible using the above configurations or do we have to write our own custom timer?

matvidako commented 5 years ago

If you use setNumMsBeforeTimeout(), onScanningDone() will be called in your ScanResultListener. The difference between timeout and successful scan is that the parameter will be RecognitionSuccessType.PARTIAL instead of RecognitionSuccessType.SUCCESSFUL.