# startScanner

Brixxapi allows users to scan barcodes or QR codes with **startScanner** function. It takes two parameters: control id, it is used to identify on which control the code value will be assigned, and options object in which we pass the bool value for continuous mode. Continuous mode, if true, provides the ability to keep the scanner open after reading code otherwise it will close. The process of reading codes consists of two steps. First step is to use this function. This function needs to be placed under a "Scanner" or "Wedge scanner" controls. When an event is triggered, this function will be called and it will access the camera of the device(if available). Now when it will read a code, this value will be assigned to scanner control in an app. In the second step, we can use this value by using **getFieldValue** function . It will be used to identify the object depending upon the code and a valueU Starts scanning QR or barcodes with the given scannerControl.

```javascript
   app.startScanner("myScannerControl");
```

### Parameters

1. controlId(String) - The control id of the scanner control (Check scanner control properties in an app).
2. scanOptions(JSON Object) - This is a json object with the scanner parameters(Used to specify the scanner functionality):
   * continuousMode(Bool - Optional - Default: false) - If true, it will keep the scanner open, after reading a code.

### Example Usages

**Start scanner with JSON options**

```javascript
   app.startScanner("myScannerControl", {
      continuousMode: true
   });
```

Here we are scanning a simpled bar code with a value of '12345678'.

![](/files/D0UxeOaXtzuLGlFcQWjv)

After scanning the code successfully, the value will be assigned to the scanner control present in current app. Now there are many ways to use this value e.g conditionals (if statements). For this tutorial, we will just show the scanned value as a notification by using the code snippet given below. As soon as the scanner scans the code it triggers an "onScan" event. In this event, we can add our customized code.

**Code when onScan Event get triggered**

```javascript
   app.showMessage({
       content: app.getFieldValue("myScannerControl")
   });
```

As we can see, it is showing the scanned value of '12345678'.

![](/files/vTT757NJtyP2792zVssx)


---

# 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://brixxbox.gitbook.io/brixxbox-documentation/client-api-reference/functions/startscanner.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.
