23 Star 41 Fork 20

xyl / BarcodeScanner

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

BarcodeScanner

###自定义更新说明

Cross-platform BarcodeScanner for Cordova / PhoneGap.

Follows the Cordova Plugin spec, so that it works with Plugman.

Supported Platforms

  • Android
  • iOS
  • Windows 8
  • Windows Phone 8

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.

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
  • PDF417
  • RSS_EXPANDED

iOS

  • QR_CODE
  • DATA_MATRIX
  • UPC_E
  • UPC_A
  • EAN_8
  • EAN_13
  • CODE_128
  • CODE_39
  • ITF

Windows8

  • 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

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:

   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);
      }
   );

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);
          }
        );

Windows8 quirks

Windows 8 implenemtation currently doesn't support encode functionality.

Windows Phone 8 quirks

Windows Phone 8 implenemtation currently doesn't support encode functionality.

Thanks on Github

So many -- check out the original iOS and Android 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 plugin 二维码扫描测试(插件开发测试)代码来源https://github.com/wildabeast/BarcodeScanner.git 优化:1 iOS 扫描框类似微信效果,添加激光线 2、android 竖屏扫描,优化扫描框,添加闪光灯功能 优化iOS 二维码扫描框,添加激光线 展开 收起
Android
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Android
1
https://gitee.com/mbyte/BarcodeScanner.git
git@gitee.com:mbyte/BarcodeScanner.git
mbyte
BarcodeScanner
BarcodeScanner
master

搜索帮助

14c37bed 8189591 565d56ea 8189591