# PhoneGap Plugin BarcodeScanner
================================
[![Build Status](https://travis-ci.org/phonegap/phonegap-plugin-barcodescanner.svg)](https://travis-ci.org/phonegap/phonegap-plugin-barcodescanner)
Cross-platform BarcodeScanner for Cordova / PhoneGap.
Follows the [Cordova Plugin spec](http://cordova.apache.org/docs/en/5.0.0/plugin_ref_spec.md), so that it works with [Plugman](https://github.com/apache/cordova-plugman).
## Installation
This requires phonegap 5.0+ ( current stable v3.0.0 )
phonegap plugin add phonegap-plugin-barcodescanner
Older versions of phonegap can still install via the __deprecated__ id ( stale v2.0.1 )
phonegap plugin add com.phonegap.plugins.barcodescanner
It is also possible to install via repo url directly ( unstable )
phonegap plugin add https://github.com/phonegap/phonegap-plugin-barcodescanner.git
### Supported Platforms
- Android
- iOS
- Windows (Windows/Windows Phone 8.1 and Windows 10)
- Windows Phone 8
- BlackBerry 10
- Browser
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
```
## Using the plugin ##
The plugin creates the object `cordova/plugin/BarcodeScanner` with the method `scan(success, fail)`.
The following barcode types are currently supported:
### Android
* QR_CODE
* DATA_MATRIX
* UPC_E
* UPC_A
* EAN_8
* EAN_13
* CODE_128
* CODE_39
* CODE_93
* CODABAR
* ITF
* RSS14
* RSS_EXPANDED
Not by default, but supported if you pass in the "formats" option:
* PDF417
* AZTEC
### iOS
* QR_CODE
* DATA_MATRIX
* UPC_E
* UPC_A
* EAN_8
* EAN_13
* CODE_128
* CODE_39
* ITF
### Windows
* UPC_A
* UPC_E
* EAN_8
* EAN_13
* CODE_39
* CODE_93
* CODE_128
* ITF
* CODABAR
* MSI
* RSS14
* QR_CODE
* DATA_MATRIX
* AZTEC
* PDF417
### Windows Phone 8
* UPC_A
* UPC_E
* EAN_8
* EAN_13
* CODE_39
* CODE_93
* CODE_128
* ITF
* CODABAR
* MSI
* RSS14
* QR_CODE
* DATA_MATRIX
* AZTEC
* PDF417
### BlackBerry 10
* UPC_A
* UPC_E
* EAN_8
* EAN_13
* CODE_39
* CODE_128
* ITF
* DATA_MATRIX
* 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:
```js
cordova.plugins.barcodeScanner.scan(
function (result) {
alert("We got a barcode\n" +
"Result: " + result.text + "\n" +
"Format: " + result.format + "\n" +
"Cancelled: " + result.cancelled);
},
function (error) {
alert("Scanning failed: " + error);
},
{
"preferFrontCamera" : true, // iOS and Android
"showFlipCameraButton" : true, // iOS and Android
"prompt" : "Place a barcode inside the scan area", // supported on Android only
"formats" : "QR_CODE,PDF_417", // default: all but PDF_417 and RSS_EXPANDED
"orientation" : "landscape" // Android only (portrait|landscape), default unset so it rotates with the device
}
);
```
## Encoding a Barcode ##
The plugin creates the object `cordova.plugins.barcodeScanner` with the method `encode(type, data, success, fail)`.
Supported encoding types:
* TEXT_TYPE
* EMAIL_TYPE
* PHONE_TYPE
* SMS_TYPE
```
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);
}
);
```
## Windows quirks ##
Windows implementation currently doesn't support encode functionality.
## Windows Phone 8 quirks ##
Windows Phone 8 implementation currently doesn't support encode functionality.
## BlackBerry 10 quirks
BlackBerry 10 implementation currently doesn't support encode functionality.
Cancelling a scan on BlackBerry 10 is done by touching the screen.
## Thanks on Github ##
So many -- check out the original [iOS](https://github.com/phonegap/phonegap-plugins/tree/DEPRECATED/iOS/BarcodeScanner), [Android](https://github.com/phonegap/phonegap-plugins/tree/DEPRECATED/Android/BarcodeScanner) and
[BlackBerry 10](https://github.com/blackberry/WebWorks-Community-APIs/tree/master/BB10-Cordova/BarcodeScanner) repos.
## Licence ##
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.
没有合适的资源?快使用搜索试试~ 我知道了~
cordova扫码插件phonegap-plugin-barcodescanner,修复了在ios10上面的内存泄漏导致的闪退b...
共73个文件
h:14个
cpp:8个
js:6个
2星 需积分: 50 34 下载量 58 浏览量
2016-12-06
08:50:17
上传
评论
收藏 2.84MB ZIP 举报
温馨提示
cordova扫码插件phonegap-plugin-barcodescanner,修复了在ios10上面的内存泄漏导致的闪退bug
资源推荐
资源详情
资源评论
收起资源包目录
phonegap-plugin-barcodescanner.zip (73个子文件)
phonegap-plugin-barcodescanner
README.md 6KB
tests
tests.js 2KB
plugin.xml 1KB
package.json 1KB
src
ios
QRCodeScanLine@2x.png 1KB
ZFMaskView.m 5KB
ScanQR3@2x.png 106B
ZFMaskView.h 276B
ZFScanViewController.h 378B
CDVCodeScanner.h 241B
ScanQR4@2x.png 106B
ScanQR1@2x.png 106B
ScanQR2@2x.png 105B
.DS_Store 6KB
ZFScanViewController.m 4KB
CDVCodeScanner.m 1KB
windows
BarcodeScannerProxy.js 17KB
lib.UW
x64
ZXing.winmd 436KB
ARM
ZXing.winmd 436KB
x86
ZXing.winmd 436KB
ANY
ZXing.winmd 436KB
lib
Properties
AssemblyInfo.cs 2KB
WinRTBarcodeReader.csproj 6KB
ZXing.winmd 436KB
Reader.cs 5KB
assets
plugin-barcodeScanner.css 1KB
android
README.md 94B
barcodescanner.gradle 317B
com
phonegap
plugins
barcodescanner
BarcodeScanner.java 11KB
barcodescanner-release-2.0.1.aar 966KB
wp8
BarcodeScannerUI.xaml.cs 6KB
BarcodeScanner.cs 4KB
BarcodeScannerUI.xaml 2KB
BarcodeScannerTask.cs 3KB
lib
zxing.wp8.0.dll 423KB
assets
cancel.png 550B
blackberry10
LICENSE 37KB
index.js 5KB
qrcode.js 33KB
native
.cproject 20KB
simulator
libBarcodeScanner.so 1.48MB
.npmignore 13B
public
json_valueiterator.inl 7KB
json_value.cpp 38KB
json_batchallocator.h 4KB
json_writer.cpp 20KB
json_internalmap.inl 16KB
plugin.cpp 7KB
tokenizer.cpp 6KB
json_reader.cpp 21KB
json_internalarray.inl 12KB
tokenizer.h 2KB
json
forwards.h 735B
config.h 2KB
value.h 33KB
writer.h 6KB
features.h 1KB
autolink.h 438B
reader.h 6KB
json.h 200B
plugin.h 2KB
.settings
com.qnx.tools.ide.core.prefs 77B
src
Logger.cpp 3KB
barcodescanner_ndk.cpp 29KB
Logger.hpp 1KB
barcodescanner_js.hpp 1KB
barcodescanner_ndk.hpp 1KB
barcodescanner_js.cpp 3KB
device
libBarcodeScanner.so 264KB
.npmignore 13B
browser
BarcodeScannerProxy.js 528B
www
barcodescanner.js 4KB
plugin.xml 8KB
共 73 条
- 1
qq_27506645
- 粉丝: 1
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页