Package com.clover.sdk.v3.scanner
Class BarcodeScanner
- java.lang.Object
-
- com.clover.sdk.v3.scanner.BarcodeScanner
-
public class BarcodeScanner extends Object
This class provides methods for interacting with the Clover barcode scanning app available on Clover devices. The Clover barcode scanning app uses the cameras built-in to Clover devices to scan barcodes. This class does not support interfacing with external barcode scanners.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ARG_SUCCESS
Deprecated.static int
BARCODE_SCANNER_FACING_CUSTOMER
Barcode scanner that primarily faces and is intended to be used by the customer.static int
BARCODE_SCANNER_FACING_DUAL
Barcode scanner that can face and be used by either the merchant or customer.static int
BARCODE_SCANNER_FACING_MERCHANT
Barcode scanner that primarily faces and is intended to be used by the merchant.
-
Constructor Summary
Constructors Constructor Description BarcodeScanner(Context context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
executeStartScan()
CallsstartScan()
from a background thread.void
executeStartScan(Bundle extras)
CallsstartScan(Bundle)
from a background thread.void
executeStopScan()
CallsstopScan()
from a background thread.void
executeStopScan(Bundle extras)
CallsstopScan(Bundle)
from a background thread.List<Integer>
getAvailable()
Retrieve the builtin barcode scanning cameras that are available on this device.protected UnstableContentResolverClient
getUnstableClient()
boolean
isProcessing()
Returns true if the barcode scanner app is currently running.void
startScan()
Open the barcode scanning app and begin scanning.boolean
startScan(Bundle extras)
Open the barcode scanning app and begin scanning.void
stopScan()
Stop the barcode scanning app.boolean
stopScan(Bundle extras)
Stop the barcode scanning app.
-
-
-
Field Detail
-
ARG_SUCCESS
@Deprecated public static final String ARG_SUCCESS
Deprecated.This field is not useful when working with this class, it should not be used.- See Also:
- Constant Field Values
-
BARCODE_SCANNER_FACING_DUAL
public static final int BARCODE_SCANNER_FACING_DUAL
Barcode scanner that can face and be used by either the merchant or customer.
-
BARCODE_SCANNER_FACING_MERCHANT
public static final int BARCODE_SCANNER_FACING_MERCHANT
Barcode scanner that primarily faces and is intended to be used by the merchant.
-
BARCODE_SCANNER_FACING_CUSTOMER
public static final int BARCODE_SCANNER_FACING_CUSTOMER
Barcode scanner that primarily faces and is intended to be used by the customer.
-
-
Constructor Detail
-
BarcodeScanner
public BarcodeScanner(Context context)
-
-
Method Detail
-
getUnstableClient
protected UnstableContentResolverClient getUnstableClient()
-
startScan
public void startScan()
Open the barcode scanning app and begin scanning. SeeBarcodeResult
for details on receiving the results. May block momentarily, preferexecuteStartScan()
.
-
startScan
public boolean startScan(Bundle extras)
Open the barcode scanning app and begin scanning. SeeBarcodeResult
for details on receiving the results. May block momentarily, preferexecuteStartScan(Bundle)
.- Parameters:
extras
- optional parameters, currently supports:Intents.EXTRA_SCANNER_FACING
- if there are multiple cameras which one to scan from, seegetAvailable()
>
-
Intents.EXTRA_SHOW_PREVIEW
- whether scanner preview video will be shown, default is true. The preview window cannot be hidden on Clover Flex 1 (C401) devices. Intents.EXTRA_LED_ON
- whether LED will be on (selected devices only), default is falseIntents.EXTRA_SCAN_QR_CODE
- whether QR codes will be scanned, default is trueIntents.EXTRA_SCAN_1D_CODE
- whether 1D codes will be scanned, default is trueIntents.EXTRA_TRANSMIT_UPC_A_CHECK_DIGIT
- whether UPC-A check digit can be transmitted, default is trueIntents.EXTRA_TRANSMIT_UPC_A_PREAMBLE
- whether UPC-A preamble can be transmitted, default is trueIntents.EXTRA_SHOW_CLOSE_BUTTON
- whether scanner preview will have a 'close' button, default is trueIntents.EXTRA_SHOW_LED_BUTTON
- whether scanner preview will have an LED toggle, default is true
- Returns:
- true if the scanning app started (it would be very unusual for it to fail)
-
stopScan
public void stopScan()
Stop the barcode scanning app. May block momentarily, preferexecuteStopScan()
.
-
stopScan
public boolean stopScan(Bundle extras)
Stop the barcode scanning app. May block momentarily, preferexecuteStopScan(Bundle)
.- Parameters:
extras
- ignored- Returns:
- true if the scanning app stopped (it would be very unusual for it to fail)
-
getAvailable
public List<Integer> getAvailable()
Retrieve the builtin barcode scanning cameras that are available on this device. One of the values returned may be passed as the extraIntents.EXTRA_SCANNER_FACING
in the bundle argument tostartScan(Bundle)
to select the appropriate barcode scanner.- Returns:
- A
List
ofInteger
s that are the available barcode scanners on this device. The list will containBARCODE_SCANNER_FACING_MERCHANT
and / orBARCODE_SCANNER_FACING_CUSTOMER
, ORBARCODE_SCANNER_FACING_DUAL
. - See Also:
startScan(Bundle)
,Intents.EXTRA_SCANNER_FACING
,BARCODE_SCANNER_FACING_MERCHANT
,BARCODE_SCANNER_FACING_CUSTOMER
,BARCODE_SCANNER_FACING_DUAL
-
isProcessing
public boolean isProcessing()
Returns true if the barcode scanner app is currently running.
-
executeStartScan
public void executeStartScan()
CallsstartScan()
from a background thread.
-
executeStartScan
public void executeStartScan(Bundle extras)
CallsstartScan(Bundle)
from a background thread.
-
executeStopScan
public void executeStopScan()
CallsstopScan()
from a background thread.
-
executeStopScan
public void executeStopScan(Bundle extras)
CallsstopScan(Bundle)
from a background thread.- Parameters:
extras
- seestopScan(Bundle)
-
-