Barcode Scanner
Allows your mobile application to use the camera to scan QR codes, EAN-13 and other kinds of barcodes.
Supported Platforms
This plugin requires a Rust version of at least 1.77.2
Platform | Level | Notes |
---|---|---|
windows | | |
linux | | |
macos | | |
android | ||
ios |
Setup
Install the barcode-scanner plugin to get started.
Use your project’s package manager to add the dependency:
-
Run the following command in the
src-tauri
folder to add the plugin to the project’s dependencies inCargo.toml
: -
Modify
lib.rs
to initialize the plugin: -
Install the JavaScript Guest bindings using your preferred JavaScript package manager:
Configuration
On iOS the barcode scanner plugin requires the NSCameraUsageDescription
information property list value, which should describe why your app needs to use the camera.
In the src-tauri/Info.ios.plist
file, add the following snippet:
Usage
The barcode scanner plugin is available in JavaScript.
Permissions
By default all potentially dangerous plugin commands and scopes are blocked and cannot be accessed. You must modify the permissions in your capabilities
configuration to enable these.
See the Capabilities Overview for more information and the step by step guide to use plugin permissions.
Default Permission
This permission set configures which barcode scanning features are by default exposed.
Granted Permissions
It allows all barcode related features.
allow-cancel
allow-check-permissions
allow-open-app-settings
allow-request-permissions
allow-scan
allow-vibrate
Permission Table
Identifier | Description |
---|---|
|
Enables the cancel command without any pre-configured scope. |
|
Denies the cancel command without any pre-configured scope. |
|
Enables the check_permissions command without any pre-configured scope. |
|
Denies the check_permissions command without any pre-configured scope. |
|
Enables the open_app_settings command without any pre-configured scope. |
|
Denies the open_app_settings command without any pre-configured scope. |
|
Enables the request_permissions command without any pre-configured scope. |
|
Denies the request_permissions command without any pre-configured scope. |
|
Enables the scan command without any pre-configured scope. |
|
Denies the scan command without any pre-configured scope. |
|
Enables the vibrate command without any pre-configured scope. |
|
Denies the vibrate command without any pre-configured scope. |
© 2024 Tauri Contributors. CC-BY / MIT