public class BarcodeResult extends Object
INTENT_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); }
Modifier and Type | Field and Description |
---|---|
static String |
INTENT_ACTION
Broadcast Action: Sent by Clover when a barcode is scanned.
|
Constructor and Description |
---|
BarcodeResult(Intent intent)
Constructs an instance of this class from an Intent received with the action
INTENT_ACTION . |
Modifier and Type | Method and 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 action
INTENT_ACTION . |
boolean |
isCode128()
True if this is a code 128, false if not or if scanner is USB barcode scanner.
|
boolean |
isCode128OrUSB()
Returns true if
isCode128() 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 if
isQRCode() 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 if
isUPCA() 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 if
isUPCE() is true or scanner is a USB barcode scanner. |
boolean |
isUSB()
Returns true if the Barcode originated from an external USB barcode scanner.
|
public static final String INTENT_ACTION
public BarcodeResult(Intent intent)
INTENT_ACTION
.public boolean isBarcodeAction()
INTENT_ACTION
. When used
properly calling this method isn't necessary.public String getBarcode()
public String getType()
public boolean isQRCode()
public boolean isCode128()
public boolean isUPCA()
public boolean isUPCE()
public boolean isUSB()
ismethods will return false.
public boolean isQRCodeOrUSB()
isQRCode()
is true or scanner is a USB barcode scanner.public boolean isCode128OrUSB()
isCode128()
is true or scanner is a USB barcode scanner.public boolean isUPCAOrUSB()
isUPCA()
is true or scanner is a USB barcode scanner.public boolean isUPCEOrUSB()
isUPCE()
is true or scanner is a USB barcode scanner.