public class BarcodeScannerConnection
extends java.lang.Object
Manages the connection to BarcodeScannerService.
{link bindToBarcodeScannerService()} start the connection process (bind) to {link BarcodeScannerService}
while unbindFromBarcodeScannerService() disconnect from it.
While connected you can use:
scanOneBarcode(): To trigger the scanning of a single barcodescanMultipleBarcodes(): To trigger the scanning of multiple barcodes (Service doesen't stop scanning after the first positive result)stopScanning(): To abort the current scanningBind to the barcode scanner service only if needed: the service keeps "warm" the hardware for scanning from binding till unbind consuming more power so Applications must to bind to the scanner only when needed:
Since the preparation and release of {link BarcodeScannerService} are long time tasks, you can use
startCachedBarcodeScannerService() to bind to the scannig service.
Doing this, {link BarcodeScannerService} will be started to cache it's state with a
timeout and {link IBarcodeScannerService.release()} will not be called
on unbind. In this way it is the service
itself that is in charge of releasing it's state when no clients are connected after a timeout.
| Constructor and Description |
|---|
BarcodeScannerConnection(Context ctx,
BarcodeScannerConnectionInterface cb) |
| Modifier and Type | Method and Description |
|---|---|
void |
bindToBarcodeScannerService() |
int |
scanMultipleBarcodes() |
int |
scanOneBarcode() |
void |
startCachedBarcodeScannerService() |
void |
stopScanning() |
void |
unbindFromBarcodeScannerService() |
public BarcodeScannerConnection(Context ctx,
BarcodeScannerConnectionInterface cb)
public void bindToBarcodeScannerService()
public void startCachedBarcodeScannerService()
public void unbindFromBarcodeScannerService()
public void stopScanning()
public int scanMultipleBarcodes()
public int scanOneBarcode()