public class BarcodeScanner extends Object
Modifier and Type | Field and 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 and Description |
---|
BarcodeScanner(Context context) |
Modifier and Type | Method and Description |
---|---|
void |
executeStartScan()
Calls
startScan() from a background thread. |
void |
executeStartScan(Bundle extras)
Calls
startScan(Bundle) from a background thread. |
void |
executeStopScan()
Calls
stopScan() from a background thread. |
void |
executeStopScan(Bundle extras)
Calls
stopScan(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.
|
@Deprecated public static final String ARG_SUCCESS
public static final int BARCODE_SCANNER_FACING_DUAL
public static final int BARCODE_SCANNER_FACING_MERCHANT
public static final int BARCODE_SCANNER_FACING_CUSTOMER
public BarcodeScanner(Context context)
protected UnstableContentResolverClient getUnstableClient()
public void startScan()
BarcodeResult
for details on
receiving the results. May block momentarily, prefer executeStartScan()
.public boolean startScan(Bundle extras)
BarcodeResult
for details on
receiving the results. May block momentarily, prefer executeStartScan(Bundle)
.extras
- optional parameters, currently supports:
Intents.EXTRA_SCANNER_FACING
- if there are multiple cameras which one to scan from, see getAvailable()
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_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 truepublic void stopScan()
executeStopScan()
.public boolean stopScan(Bundle extras)
executeStopScan(Bundle)
.extras
- ignoredpublic List<Integer> getAvailable()
Intents.EXTRA_SCANNER_FACING
in the bundle argument to startScan(Bundle)
to select the appropriate barcode scanner.List
of Integer
s that are the available barcode scanners on this device. The list will contain
BARCODE_SCANNER_FACING_MERCHANT
and / or BARCODE_SCANNER_FACING_CUSTOMER
, OR
BARCODE_SCANNER_FACING_DUAL
.startScan(Bundle)
,
Intents.EXTRA_SCANNER_FACING
,
BARCODE_SCANNER_FACING_MERCHANT
,
BARCODE_SCANNER_FACING_CUSTOMER
,
BARCODE_SCANNER_FACING_DUAL
public boolean isProcessing()
public void executeStartScan()
startScan()
from a background thread.public void executeStartScan(Bundle extras)
startScan(Bundle)
from a background thread.public void executeStopScan()
stopScan()
from a background thread.public void executeStopScan(Bundle extras)
stopScan(Bundle)
from a background thread.extras
- see stopScan(Bundle)