SparkScan Listener

Defined in package com.scandit.datacapture.barcode.spark.capture

SparkScanListener
interface SparkScanListener

Added in version 6.11.0

Listener interface for traditional SparkScan.

onBarcodeScanned(sparkScan, session, data)
void onBarcodeScanned(@NonNull SparkScan sparkScan,
        @NonNull SparkScanSession session,
        @Nullable FrameData data)

Added in version 6.11.0

Invoked whenever a code has been scanned. The newly scanned barcode can be retrieved from SparkScanSession.newlyRecognizedBarcode.

This method is invoked from a recognition internal thread. To perform UI work, you must dispatch to the main thread first. After receiving this callback, you will typically want to start processing the scanned barcodes. Keep in mind however, that any further recognition is blocked until this method completes. Therefore, if you need to perform a time-consuming operation, like querying a database or opening an URL encoded in the barcode data, consider switching to another thread.

Sometimes, after receiving this callback, you may want to stop scanning. You can do that by disabling the SparkScan.

FrameData is null if the camera is frozen and the selection is changed.

onSessionUpdated(sparkScan, session, data)
void onSessionUpdated(@NonNull SparkScan sparkScan,
        @NonNull SparkScanSession session,
        @Nullable FrameData data)

Added in version 6.11.0

Invoked after a frame has been processed by SparkScan and the session has been updated. In contrast to onBarcodeScanned(), this method is invoked, regardless whether a code was scanned or not. If codes were recognized in this frame, this method is invoked after onBarcodeScanned().

This method is invoked from a recognition internal thread. To perform UI work, you must dispatch to the main thread first. Further recognition is blocked until this method completes. It is thus recommended to do as little work as possible in this method.

FrameData is null if the camera is frozen and the selection is changed.