# 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.

   ![](/files/OAVGtaO4hYcWAzRpAWhN)

   ![](/files/6gQ81NQUA2Nz3Hgi4nqF)
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.

   ![](/files/y8VZ9Xgj0WfS6Fe34Ikt)

   ![](/files/Ln78WltSKqi5foES605A)

### 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.emobiq.com/emobiq-client/006-actions-and-visual-logic/action-reference/cordova/device/barcodescanner.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
