scanBarcode Procedure

Parts and equipment usually have barcodes printed on their package. The scanBarcode procedure provides the barcode and 2D (for example, QR, DATAMATRIX) code scanner functionality that helps searching for items in the inventory pools easy.

When the plug-in calls this procedure, the scanner window opens and shows the live camera picture. When the barcode is recognized, the scanner window closes, and the result is sent to the plug-in through the callProcedureResult method. If the barcode scanner is unavailable or Oracle Field Service Core Application isn't run inside the Oracle Field Service Mobile (for Android or iOS) application, an error code is returned to the plug-in through an error message. For more information about the callProcedureResult method, see the callProcedureResult Method topic in the Mobile Plug-in Framework guide.

Note: You must have the Oracle Field Service Mobile (for Android or iOS) application to use the Barcode Scanner through the plug-in API and to search by barcode.
Supported Barcode and 2D Code Types
This table provides the barcode and 2D code types:
Barcode Type Android iOS
QR_CODE Yes Yes
DATA_MATRIX Yes Yes
UPC_A Yes Yes
UPC_E Yes Yes
EAN_8 Yes Yes
EAN_13 Yes Yes
CODE_39 Yes Yes
CODE_93 Yes No
CODE_128 Yes Yes
CODABAR Yes No
ITF Yes Yes
RSS14 Yes No
PDF417 Yes No
RSS_EXPANDED Yes No
Example of the callProcedure Message
{
    "apiVersion": 1,
    "method": "callProcedure",
    "procedure": "scanBarcode",
    "callId": "123abc"
}
Result of the callProcedure Procedure
For this procedure, the resultData param of the callProcedureResult message is an object, which contains these fields:
Parameter Type Description
apiVersion String Plugin API version.
format String Type of recognized barcode. See Supported barcode and 2D code types.
cancelled String Equals true if user closed the scanner window before the code's recognized.
Example of the callProcedureResult Message
When the barcode is scanned successfully:
{
    "apiVersion": 1,
    "method": "callProcedureResult",
    "callId": "123abc",
    "resultData": {
        "text": "PT9012308",
        "format": "QR_CODE",
        "cancelled": false
    }
}
When user cancels scanning:
{
    "apiVersion": 1,
    "method": "callProcedureResult",
    "callId": "123abc",
    "resultData": {
        "text": "",
        "format": "",
        "cancelled": true
    }
}