首页 > 解决方案 > 离子科尔多瓦条形码扫描仪 - 相机未打开扫描

问题描述

我正在使用 ionic - phonegap-plugin-barcodescanner": "^7.1.2" 进行条形码扫描,但是当我单击扫描按钮时 - 相机在 android 模拟器上如下所示。https: //i.stack.imgur.com /e1xL4.png https://i.stack.imgur.com/NS5IB.png

这是我的代码:scan() {

this.options = {
  preferFrontCamera: true,
  showFlipCameraButton: true,
  prompt: "scan the barcode here 111"
}

this.barcodeScanner.scan(this.options).then((barcodeData) => {
  this.data = barcodeData;
  console.log(barcodeData);
}, (err) => {
  this.toast.show(err, '5000', 'center').subscribe(
    toast => {
      console.log(toast);
    }
  );
});

}

index.html 具有以下内容.. < ion-app style="background: none transparent !important;">

任何人都可以请帮助代码有什么问题。

标签: ionic-frameworkcordova-pluginsphonegap-pluginsbarcode-scanner

解决方案


尝试使用这个插件

<plugin spec="https://github.com/Telerik-Verified-Plugins/BarcodeScanner.git" source="git" />

推荐阅读