Gathering detailed insights and metrics for phonegap-plugin-barcodescanner
Gathering detailed insights and metrics for phonegap-plugin-barcodescanner
Gathering detailed insights and metrics for phonegap-plugin-barcodescanner
Gathering detailed insights and metrics for phonegap-plugin-barcodescanner
cross-platform BarcodeScanner for Cordova / PhoneGap
npm install phonegap-plugin-barcodescanner
Typescript
Module System
Node Version
NPM Version
Objective-C++ (42.35%)
JavaScript (36.28%)
Java (12.8%)
C# (7.03%)
CSS (1.54%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1,273 Stars
495 Commits
1,415 Forks
86 Watchers
5 Branches
81 Contributors
Updated on May 16, 2025
Latest Version
8.1.0
Package Id
phonegap-plugin-barcodescanner@8.1.0
Unpacked Size
3.31 MB
Size
1.96 MB
File Count
37
NPM Version
6.9.0
Node Version
12.4.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
================================
Cross-platform BarcodeScanner for Cordova / PhoneGap.
Follows the Cordova Plugin spec, so that it works with Plugman.
This requires phonegap 7.1.0+ ( current stable v8.0.0 )
phonegap plugin add phonegap-plugin-barcodescanner
It is also possible to install via repo url directly ( unstable )
phonegap plugin add https://github.com/phonegap/phonegap-plugin-barcodescanner.git
Optional variables:
This plugin requires the Android support library v4. The minimum version is 24.1.0
. Default value is 27.+
. Check out the latest version here.
phonegap plugin add phonegap-plugin-barcodescanner --variable ANDROID_SUPPORT_V4_VERSION="27.1.1"
Note: the Android source for this project includes an Android Library Project. plugman currently doesn't support Library Project refs, so its been prebuilt as a jar library. Any updates to the Library Project should be committed with an updated jar.
Note: Windows 10 applications can not be build for AnyCPU
architecture, which is default for Windows platform. If you want to build/run Windows 10 app, you should specify target architecture explicitly, for example (Cordova CLI):
cordova run windows -- --archs=x86
Add the following to your config.xml:
<!-- add a version here, otherwise PGB will use whatever the latest version of the package on npm is -->
<plugin name="phonegap-plugin-barcodescanner" />
On PhoneGap Build if you're using a version of cordova-android of 4 or less, ensure you're building with gradle:
<preference name="android-build-tool" value="gradle" />
The plugin creates the object cordova.plugins.barcodeScanner
with the method scan(success, fail)
.
The following barcode types are currently supported:
Barcode Type | Android | iOS | Windows |
---|---|---|---|
QR_CODE | ✔ | ✔ | ✔ |
DATA_MATRIX | ✔ | ✔ | ✔ |
UPC_A | ✔ | ✔ | ✔ |
UPC_E | ✔ | ✔ | ✔ |
EAN_8 | ✔ | ✔ | ✔ |
EAN_13 | ✔ | ✔ | ✔ |
CODE_39 | ✔ | ✔ | ✔ |
CODE_93 | ✔ | ✔ | ✔ |
CODE_128 | ✔ | ✔ | ✔ |
CODABAR | ✔ | ✖ | ✔ |
ITF | ✔ | ✔ | ✔ |
RSS14 | ✔ | ✖ | ✔ |
PDF_417 | ✔ | ✔ | ✔ |
RSS_EXPANDED | ✔ | ✖ | ✖ |
MSI | ✖ | ✖ | ✔ |
AZTEC | ✔ | ✔ | ✔ |
success
and fail
are callback functions. Success is passed an object with data, type and cancelled properties. Data is the text representation of the barcode data, type is the type of barcode detected and cancelled is whether or not the user cancelled the scan.
A full example could be:
1 cordova.plugins.barcodeScanner.scan( 2 function (result) { 3 alert("We got a barcode\n" + 4 "Result: " + result.text + "\n" + 5 "Format: " + result.format + "\n" + 6 "Cancelled: " + result.cancelled); 7 }, 8 function (error) { 9 alert("Scanning failed: " + error); 10 }, 11 { 12 preferFrontCamera : true, // iOS and Android 13 showFlipCameraButton : true, // iOS and Android 14 showTorchButton : true, // iOS and Android 15 torchOn: true, // Android, launch with the torch switched on (if available) 16 saveHistory: true, // Android, save scan history (default false) 17 prompt : "Place a barcode inside the scan area", // Android 18 resultDisplayDuration: 500, // Android, display scanned text for X ms. 0 suppresses it entirely, default 1500 19 formats : "QR_CODE,PDF_417", // default: all but PDF_417 and RSS_EXPANDED 20 orientation : "landscape", // Android only (portrait|landscape), default unset so it rotates with the device 21 disableAnimations : true, // iOS 22 disableSuccessBeep: false // iOS and Android 23 } 24 );
The plugin creates the object cordova.plugins.barcodeScanner
with the method encode(type, data, success, fail)
.
Supported encoding types:
A full example could be:
cordova.plugins.barcodeScanner.encode(cordova.plugins.barcodeScanner.Encode.TEXT_TYPE, "http://www.nytimes.com", function(success) {
alert("encode success: " + success);
}, function(fail) {
alert("encoding failed: " + fail);
}
);
Since iOS 10 it's mandatory to add a NSCameraUsageDescription
in the Info.plist
.
NSCameraUsageDescription
describes the reason that the app accesses the user's camera.
When the system prompts the user to allow access, this string is displayed as part of the dialog box. If you didn't provide the usage description, the app will crash before showing the dialog. Also, Apple will reject apps that access private data but don't provide an usage description.
To add this entry you can use the edit-config
tag in the config.xml
like this:
<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
<string>To scan barcodes</string>
</edit-config>
Windows implementation currently doesn't support encode functionality.
On Windows 10 desktop ensure that you have Windows Media Player and Media Feature pack installed.
So many -- check out the original iOS, Android and BlackBerry 10 repos.
The MIT License
Copyright (c) 2010 Matt Kane
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
No vulnerabilities found.
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
binaries present in source code
Details
Reason
Found 11/28 approved changesets -- score normalized to 3
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More