public final class BarcodeReader extends ServiceConnector implements IBarcodeReader
ServiceConnector.InternalServiceConnectionACTION_BIND_V2, SERVICES_PACKAGE| Modifier and Type | Method and Description | 
|---|---|
protected android.content.Intent | 
getBindIntent()
Can be overrided to connect to other services 
 | 
static IBarcodeReader | 
getInstance(android.content.Context context)
Return a global instance of Barcode Reader, which is the default implementation of
  
IBarcodeReader, and instantiate it if needed. | 
java.util.List<PreviewSize> | 
getPreviewSizes(int cameraType)
Get the list of preview sizes supported by the service according the camera type selected on
 the current device or payment terminal. 
 | 
protected java.lang.String | 
getServiceName()
Must be overrided to provide service class name used for binding. 
 | 
java.util.List<java.lang.Integer> | 
getSymbols()
Get the list of symbols supported by the service according the barcode decoding library
 selected on the current device or payment terminal. 
 | 
protected void | 
onServiceReady(android.os.IBinder service)
Internal callback when service is connected. 
 | 
protected void | 
onServiceUnbinded()
Internal callback when service is disconnected. 
 | 
void | 
registerBarcodeReaderListener(IBarcodeReaderResultListener listener)
Register a new listener for BarcodeReader event sent during the process. 
 | 
void | 
start(BarcodeReaderInputData inputData)
Start a barcode reader according to the parameters filled in inputData field. 
 | 
void | 
start(BarcodeReaderInputData inputData,
     android.view.Surface inputPreview)
Start a barcode reader according to the parameters filled in inputData field. 
 | 
void | 
stop()
Stop the barcode reader process. 
 | 
void | 
unregisterBarcodeReaderListener(IBarcodeReaderResultListener listener)
Unregister an existing barcode reader listener. 
 | 
connect, connectSync, disconnect, ensureServiceIsReady, getContext, isConnectedpublic static IBarcodeReader getInstance(android.content.Context context)
IBarcodeReader, and instantiate it if needed.
 
 Be aware that only one instance will be created for the whole application, so the associated
 context should not be a component which could be destroyed at some point, ie. an Activity.
 Passing the Application to this method is preferred over other context types.
context - A valid context to initialize the instance.protected android.content.Intent getBindIntent()
ServiceConnectorgetBindIntent in class ServiceConnectorpublic java.util.List<PreviewSize> getPreviewSizes(int cameraType) throws IngenicoException
Usage example:
IBarcodeReaderbarcodeReader = BarcodeReader.getInstance(context); // Check that 640x480 preview size is available on the front camera boolean expectedSizeIsAvailable = false;List<PreviewSize> previewSizes = barcodeReader.getPreviewSizes(CameraTypes.FRONT); for (PreviewSizesize : previewSizes) { if ((size.getWidth() == 640) && (size.getHeight() == 480)) { expectedSizeIsAvailable = true; break; } } if (expectedSizeIsAvailable) { // Start barcode reader with a 640x480 preview size }
getPreviewSizes in interface IBarcodeReaderIngenicoException - when could not retrieve the preview sizespublic java.util.List<java.lang.Integer> getSymbols()
getSymbols in interface IBarcodeReaderpublic void start(@NonNull
                  BarcodeReaderInputData inputData)
           throws IngenicoException
start in interface IBarcodeReaderinputData - barcode reader parametersIngenicoException - when the start barcode reader call failspublic void start(@NonNull
                  BarcodeReaderInputData inputData,
                  @NonNull
                  android.view.Surface inputPreview)
           throws IngenicoException
start in interface IBarcodeReaderinputData - barcode reader parametersinputPreview - use TextureView to display a content stream come from camera
                     previewIngenicoException - when the start barcode reader call failspublic void stop()
          throws IngenicoException
stop in interface IBarcodeReaderIngenicoException - when the stop barcode reader call fails (not started)public void registerBarcodeReaderListener(@NonNull
                                          IBarcodeReaderResultListener listener)
IBarcodeReaderregisterBarcodeReaderListener in interface IBarcodeReaderlistener - barcode reader listenerpublic void unregisterBarcodeReaderListener(@NonNull
                                            IBarcodeReaderResultListener listener)
IBarcodeReaderunregisterBarcodeReaderListener in interface IBarcodeReaderlistener - barcode reader listenerprotected java.lang.String getServiceName()
ServiceConnectorgetServiceName in class ServiceConnectorprotected void onServiceReady(android.os.IBinder service)
ServiceConnectoronServiceReady in class ServiceConnectorprotected void onServiceUnbinded()
ServiceConnectoronServiceUnbinded in class ServiceConnector