# barcodeScanner

## Description

Activates a barcode scanner using the camera of the device.

## Input / Parameter

| Name                 | Description                                                                                       | Input Type  | Default | Options     | Required |
| -------------------- | ------------------------------------------------------------------------------------------------- | ----------- | ------- | ----------- | -------- |
| showFlipCameraButton | Show flip camera button. Supported on iOS and Android.                                            | Boolean     | true    | true, false | No       |
| showTorchButton      | Show torch button. Supported on iOS and Android.                                                  | Boolean     | true    | true, false | No       |
| torchOn              | Launch with the torch switched on (if available). Supported on Android only.                      | Boolean     | false   | true, false | No       |
| prompt               | Prompt text. Supported on Android only.                                                           | String/Text | -       | -           | No       |
| resultDuration       | Display scanned text for X ms. 0 suppresses it entirely, default 1500. Supported on Android only. | Number      | 500?    | -           | No       |

## Output

N/A

## Callback

### callback

The function to be executed if the barcode scanner is activated successfully.

### errorCallback

The function to be executed if the barcode scanner is not activated successfully.

## Video

Coming Soon.

## Example

The user wants to scan a barcode and display the value in a dialog.

### Steps

1. Drag a button to a page in the mobile designer. Select the event click and drag the barcodeScanner function to the event flow.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-7141db77e23c41f2f2fc1874a06d794b4ca0feeb%2FbarcodeScanner-step-1.png?alt=media)

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-c16ee58b88df5749e64a961fe07307fc0b6e2dca%2FbarcodeScanner-step-2.png?alt=media)
2. Drag the function to be executed when the barcode scanner is activated successfully. In this example, we are using the infoDialog function. Fill in the parameters of the function.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-93b957bdcdf0e3015ad12043c02553292c979e23%2FbarcodeScanner-step-3.png?alt=media)

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-bf86a5c0ca25a62673fbc3286e786d81f5b6b478%2FbarcodeScanner-step-4.png?alt=media)

### Result

When the button is pressed, the barcode scanner will be activated. After scanning the barcode, the value will be displayed in a dialog box.

## Links
