Package com.clover.sdk.v3.scanner
Class BarcodeResult
- java.lang.Object
-
- com.clover.sdk.v3.scanner.BarcodeResult
-
public class BarcodeResult extends Object
This helper class can be constructed from an Intent received by a broadcast receiver that is registered forINTENT_ACTION
. Once constructed methods in this class are used to obtain information about the barcode tha was scanned.public void onStart() { IntentFilter filter = new IntentFilter(BarcodeResult.INTENT_ACTION); registerReceiver(mBarcodeReceiver, filter); } private final BroadcastReceiver mBarcodeReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { BarcodeResult br = new BarcodeResult(intent); Log.d(TAG, "Received scan with result" + br.getBarcode()); } }; public void onStop() { unregisterReceiver(mBarcodeReceiver); }
-
-
Field Summary
Fields Modifier and Type Field Description static String
INTENT_ACTION
Broadcast Action: Sent by Clover when a barcode is scanned.
-
Constructor Summary
Constructors Constructor Description BarcodeResult(Intent intent)
Constructs an instance of this class from an Intent received with the actionINTENT_ACTION
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getBarcode()
Returns the data encoded by the barcode as a String.String
getType()
Returns a String that describes the type of barcode.boolean
isBarcodeAction()
True unless the Intent provided does not have the actionINTENT_ACTION
.boolean
isCode128()
True if this is a code 128, false if not or if scanner is USB barcode scanner.boolean
isCode128OrUSB()
Returns true ifisCode128()
is true or scanner is a USB barcode scanner.boolean
isQRCode()
True if this is a QR code, false if not or if scanner is USB barcode scanner.boolean
isQRCodeOrUSB()
Returns true ifisQRCode()
is true or scanner is a USB barcode scanner.boolean
isUPCA()
True if this is a UPCA, false if not or if scanner is USB barcode scanner.boolean
isUPCAOrUSB()
Returns true ifisUPCA()
is true or scanner is a USB barcode scanner.boolean
isUPCE()
True if this is a UPCE, false if not or if scanner is USB barcode scanner.boolean
isUPCEOrUSB()
Returns true ifisUPCE()
is true or scanner is a USB barcode scanner.boolean
isUSB()
Returns true if the Barcode originated from an external USB barcode scanner.
-
-
-
Field Detail
-
INTENT_ACTION
public static final String INTENT_ACTION
Broadcast Action: Sent by Clover when a barcode is scanned.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BarcodeResult
public BarcodeResult(Intent intent)
Constructs an instance of this class from an Intent received with the actionINTENT_ACTION
.
-
-
Method Detail
-
isBarcodeAction
public boolean isBarcodeAction()
True unless the Intent provided does not have the actionINTENT_ACTION
. When used properly calling this method isn't necessary.
-
getBarcode
public String getBarcode()
Returns the data encoded by the barcode as a String.
-
getType
public String getType()
Returns a String that describes the type of barcode. Returns "usb" for barcodes scanned by USB barcode scanners since the actual type is unknown.
-
isQRCode
public boolean isQRCode()
True if this is a QR code, false if not or if scanner is USB barcode scanner.
-
isCode128
public boolean isCode128()
True if this is a code 128, false if not or if scanner is USB barcode scanner.
-
isUPCA
public boolean isUPCA()
True if this is a UPCA, false if not or if scanner is USB barcode scanner.
-
isUPCE
public boolean isUPCE()
True if this is a UPCE, false if not or if scanner is USB barcode scanner.
-
isUSB
public boolean isUSB()
Returns true if the Barcode originated from an external USB barcode scanner. Barcodes from such scanners will not have a type and all the standardis
methods will return false.
-
isQRCodeOrUSB
public boolean isQRCodeOrUSB()
Returns true ifisQRCode()
is true or scanner is a USB barcode scanner.
-
isCode128OrUSB
public boolean isCode128OrUSB()
Returns true ifisCode128()
is true or scanner is a USB barcode scanner.
-
isUPCAOrUSB
public boolean isUPCAOrUSB()
Returns true ifisUPCA()
is true or scanner is a USB barcode scanner.
-
isUPCEOrUSB
public boolean isUPCEOrUSB()
Returns true ifisUPCE()
is true or scanner is a USB barcode scanner.
-
-