Skip to content

CheckBarcodeScannerPrerequisite

This action checks if the prerequisites like camera or another third-party device is available for barcode scanning.

All the properties defined under Action are applicable to this action.

CheckBarcodeScannerPrerequisite Properties

Property Type Required
_Type const Yes

_Type

  • type: const

The value of this property must be:

"Action.Type.CheckBarcodeScannerPrerequisite"

Action Result

Refer to the MDK Guide to understand what an action result is.

When this action gets executed successfully, the ActionResult is a Boolean value indicating whether the pre-requisites are met. Otherwise it’s an error message.


Examples

{
    "_Type": "Action.Type.CheckBarcodeScannerPrerequisite",
    "OnSuccess": "/MDKApp/Rules/BarcodeScanner/CheckBarcodeScannerPrerequisiteResult.js", 
    "OnFailure": "/MDKApp/Actions/BarcodeScanner/CheckBarcodeScannerPrerequisiteFailure.action",
    "ActionResult": {
        "_Name": "CheckCamera"
    }
}
export default function CheckBarcodeScannerPrerequisiteResult(clientAPI) {
  var actionResult = clientAPI.getActionResult('CheckCamera');
  if (actionResult) {
    clientAPI.setActionBinding({
      'IsCameraReady': actionResult.data,
    });
    return clientAPI.executeAction('/MDKDevApp/Actions/Navigation/BarcodeScanner/NavToBarcodeScannerPage.action');
  }
}