AppScanBarCode Method (CLIENT)
PLB Web Only, 9.9
The AppScanBarCode method provides an API for scanning barcodes. This method opens the device's default camera application to scan barcode. Once the user scans the barcode, the camera application closes and the PLB AppEventScanBarCode event is generated. The method uses the following format:
|
|
|
|
Where:
label
Optional. A Program Execution Label.
object
Required. A CLIENT object.
return
Optional. A Numeric Variable that returns the success or failure of the method.
options
Optional. A Character String Variable or string literal that specifies a JSON object string that is passed directly to the Cordova routine to customize the scanning operation.
Flags Affected: OVER, ZERO
Note the following:
This method is only used for a Sunbelt PL/B Web Client App using Cordova\PhoneGap operations. See the following link for details on the Cordova plugin used:
https://github.com/phonegap/phonegap-plugin-barcodescanner
The ZERO flag is set when the {return} value is zero.
The OVER flag is set if the value returned is too large to be stored into the {return} variable.
The {options} parameter is passed directly as a JSON object to the Cordova routine to customize the scanning barcode operation..
The JSON object supports and can include the following fields:
|
Field |
Description | |||||
|
preferFrontCamera |
A iOS and Android supported field that scans using the front camera. (default: true) | |||||
|
showFlipCameraButton |
A iOS and Android supported field that adds a flip camera button. (default : true ) | |||||
|
prompt |
An Android only field that specifies the message displayed in the scanning area. (default: "Place a barcode inside the scan area") | |||||
|
formats |
List of formats to support. (example "QR_CODE,PDF_417" ) (default: all but PDF_417 and RSS_EXPANDED) | |||||
|
orientation |
An Android only field that specifies either "landscape" or "portrait" for the scanning area. (default: unset so it rotates with the device) | |||||
This method starts an asynchronous operation on the mobile device which returns the result using the PLB 'AppEventScanBarCode' CLIENT object event where the event data is returned in ARG1 which contains a JSON notation string..
The event number used in EVENTREG is:
The event data is returned by this method either with a Error JSON object or a JSON object.
A JSON error object contains the fields of:
|
Field |
Description |
|
text |
Text representation of the barcode data. |
|
format |
Type of barcode detected. |
|
cancelled |
When mobile device user cancelled ths scan operation, this field is se to true. |
See Also: CLIENT, Client Methods, Method Syntax
![]() |