# @capacitor/barcode-scanner

> Capacitor plugin using Outsystems Barcode libs

Latest version **3.1.2** (published 2026-09-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @capacitor/barcode-scanner
pnpm add @capacitor/barcode-scanner
yarn add @capacitor/barcode-scanner
bun add @capacitor/barcode-scanner
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.1.2 |
| Published | 2026-09-02 |
| First published | 2024-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 154.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 64 |
| Author | OutSystems |
| Maintainers | itschaced, ionicjs, jcesarmobile, vmfo, jpender, mark-ionic, chuckytuh, alexgerardojacinto, os-pedrobilro, harvdoggy, jpender-os, ndr, kepatoto, rui.mendes, markemer, capacitor-plugin-bot, eric-ionic, os-ruialves |
| Keywords | capacitor, plugin, native |

## Links

- npm: https://www.npmjs.com/package/@capacitor/barcode-scanner
- Repository: https://github.com/ionic-team/capacitor-barcode-scanner
- Homepage: https://github.com/ionic-team/capacitor-barcode-scanner#readme
- Issues: https://github.com/ionic-team/capacitor-barcode-scanner/issues
- npm.io page: https://npm.io/package/@capacitor/barcode-scanner

## Dependencies (1)

- [html5-qrcode](https://npm.io/package/html5-qrcode.md) 2.3.8

## Recent versions

- 3.1.2 (latest) — 2026-09-02
- 3.1.3-dev-20260902T142315.0 (dev) — 2026-09-02
- 2.2.6 (latest-7) — 2026-02-11
- 3.1.2-dev-20260902T141829.0 — 2026-09-02
- 3.1.2-dev-20260819T114830.0 — 2026-08-19
- 3.1.1 — 2026-08-19
- 3.1.1-dev-20260810T171642.0 — 2026-08-10
- 3.1.1-dev-20260807T131609.0 — 2026-08-07
- 3.1.1-dev-20260727T114546.0 — 2026-07-27
- 3.1.1-dev-20260708T144848.0 — 2026-07-08
- 3.1.0 — 2026-07-08
- 3.0.3-dev-20260703T174419.0 — 2026-07-03
- 3.0.3-dev-20260626T161157.0 — 2026-06-26
- 3.0.3-dev-20260626T155517.0 — 2026-06-26
- 3.0.3-dev-20260527T134644.0 — 2026-05-27
- … 77 more at https://npm.io/package/@capacitor/barcode-scanner/versions

## README

# @capacitor/barcode-scanner

Capacitor plugin using Outsystems Barcode libs

## Install

```bash
npm install @capacitor/barcode-scanner
npx cap sync
```

#### Android

The barcode scanner plugin requires a minimum Android SDK target of 26. This is higher than the default that comes with your Capacitor application. You can update this value in your `android/variables.gradle` file.

```gradle
ext {
    minSdkVersion = 26
}
```

Note: Android with `ZXING` scanning library supports all formats, while `MLKIT` supports all except `MAXICODE`, `RSS_14`, `RSS_EXPANDED` and `UPC_EAN_EXTENSION` - using one of these in `hint` will default to scanning any format.

#### iOS

The barcode scanner uses the camera on the device. Ensure you configure the Privacy - Camera Usage Description in your Info.plist file so that your application can access the device's camera.

Note: iOS supports all formats except `MAXICODE` and `UPC_EAN_EXTENSION` - using them in `hint` will default to scanning any format. Also, Apple Vision does not distinguish between `UPC_A` and `EAN_13`, so specifying one of these in `hint` will allow to scan both.

---

## API

<docgen-index>

* [`scanBarcode(...)`](#scanbarcode)
* [Type Aliases](#type-aliases)
* [Enums](#enums)

</docgen-index>

<docgen-api>
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->

Interface defining the contract for a plugin capable of scanning barcodes.
Requires implementation of the scanBarcode method, which initiates a barcode scan with given options.

Starting in Android targetSdk 36, the scanOrientation parameter has no effect for large screens (e.g. tablets) on Android 16 and higher.
You may opt-out of this behavior in your app by adding `<property android:name="android.window.PROPERTY_COMPAT_ALLOW_RESTRICTED_RESIZABILITY" android:value="true" />` to your `AndroidManifest.xml` inside `<application>` or `<activity>`.
Keep in mind though that this opt-out is temporary and will no longer work for Android 17. Android discourages setting specific orientations for large screens.
Regular Android phones are unaffected by this change.
For more information check the Android docs at https://developer.android.com/about/versions/16/behavior-changes-16#adaptive-layouts

### scanBarcode(...)

```typescript
scanBarcode(options: CapacitorBarcodeScannerOptions) => Promise<CapacitorBarcodeScannerScanResult>
```

| Param         | Type                                                                                      |
| ------------- | ----------------------------------------------------------------------------------------- |
| **`options`** | <code><a href="#capacitorbarcodescanneroptions">CapacitorBarcodeScannerOptions</a></code> |

**Returns:** <code>Promise&lt;<a href="#capacitorbarcodescannerscanresult">CapacitorBarcodeScannerScanResult</a>&gt;</code>

--------------------


### Type Aliases


#### CapacitorBarcodeScannerScanResult

Defines the structure of the result returned from a barcode scan.

<code>{ ScanResult: string; format: <a href="#capacitorbarcodescannertypehint">CapacitorBarcodeScannerTypeHint</a>; }</code>


#### CapacitorBarcodeScannerTypeHint

Extends supported formats from Html5Qrcode with a special 'ALL' option,
indicating support for all barcode types.
Type definition combining <a href="#html5qrcodesupportedformats">Html5QrcodeSupportedFormats</a> and OSBarcodeTypeHintALLOption
to represent the hint for the type of barcode to be scanned.

<code><a href="#html5qrcodesupportedformats">Html5QrcodeSupportedFormats</a> | <a href="#capacitorbarcodescannertypehintalloption">CapacitorBarcodeScannerTypeHintALLOption</a></code>


#### CapacitorBarcodeScannerOptions

Defines the options for configuring a barcode scan.

<code>{ hint: <a href="#capacitorbarcodescannertypehint">CapacitorBarcodeScannerTypeHint</a>; scanInstructions?: string; scanButton?: boolean; scanText?: string; cameraDirection?: <a href="#capacitorbarcodescannercameradirection">CapacitorBarcodeScannerCameraDirection</a>; scanOrientation?: <a href="#capacitorbarcodescannerscanorientation">CapacitorBarcodeScannerScanOrientation</a>; /** * Accessibility label (alternative text) read by screen readers for the cancel button. * When omitted, no accessibility label is set. Has no effect on web. */ cancelButtonAccessibilityLabel?: string; /** * Accessibility label (alternative text) read by screen readers for the torch button when the torch is on. * When omitted, no accessibility label is set. Has no effect on web. */ torchButtonOnAccessibilityLabel?: string; /** * Accessibility label (alternative text) read by screen readers for the torch button when the torch is off. * When omitted, no accessibility label is set. Has no effect on web. */ torchButtonOffAccessibilityLabel?: string; android?: { scanningLibrary?: <a href="#capacitorbarcodescannerandroidscanninglibrary">CapacitorBarcodeScannerAndroidScanningLibrary</a>; }; web?: { showCameraSelection?: boolean; scannerFPS?: number; }; }</code>


### Enums


#### Html5QrcodeSupportedFormats

| Members                 | Value           |
| ----------------------- | --------------- |
| **`QR_CODE`**           | <code>0</code>  |
| **`AZTEC`**             | <code>1</code>  |
| **`CODABAR`**           | <code>2</code>  |
| **`CODE_39`**           | <code>3</code>  |
| **`CODE_93`**           | <code>4</code>  |
| **`CODE_128`**          | <code>5</code>  |
| **`DATA_MATRIX`**       | <code>6</code>  |
| **`MAXICODE`**          | <code>7</code>  |
| **`ITF`**               | <code>8</code>  |
| **`EAN_13`**            | <code>9</code>  |
| **`EAN_8`**             | <code>10</code> |
| **`PDF_417`**           | <code>11</code> |
| **`RSS_14`**            | <code>12</code> |
| **`RSS_EXPANDED`**      | <code>13</code> |
| **`UPC_A`**             | <code>14</code> |
| **`UPC_E`**             | <code>15</code> |
| **`UPC_EAN_EXTENSION`** | <code>16</code> |


#### CapacitorBarcodeScannerTypeHintALLOption

| Members   | Value           |
| --------- | --------------- |
| **`ALL`** | <code>17</code> |


#### CapacitorBarcodeScannerCameraDirection

| Members     | Value          |
| ----------- | -------------- |
| **`BACK`**  | <code>1</code> |
| **`FRONT`** | <code>2</code> |


#### CapacitorBarcodeScannerScanOrientation

| Members         | Value          |
| --------------- | -------------- |
| **`PORTRAIT`**  | <code>1</code> |
| **`LANDSCAPE`** | <code>2</code> |
| **`ADAPTIVE`**  | <code>3</code> |


#### CapacitorBarcodeScannerAndroidScanningLibrary

| Members     | Value                |
| ----------- | -------------------- |
| **`ZXING`** | <code>"zxing"</code> |
| **`MLKIT`** | <code>"mlkit"</code> |

</docgen-api>

---
_Source: https://npm.io/package/@capacitor/barcode-scanner · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
