【问题标题】:How to fix phonegap-plugin-barcodescanner on android如何在 android 上修复 phonegap-plugin-barcodescanner
【发布时间】:2019-06-18 12:55:18
【问题描述】:

我正在尝试在我的应用程序上使用 Phonegap 条码扫描器插件。当我在 Phonegap Desktop 中查看时,扫描仪不显示,但我收到一条警告,要求我输入条形码编号。但是,当我打包应用程序,提交到 Phonegap Build 并在我的手机上进行测试时,条形码扫描仪/相机没有打开,也没有出现警报。

我已将 android 和浏览器作为平台安装到我的项目中。

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

【问题讨论】:

  • 只需添加,您可以使用Phonegap 应用程序立即在您的Android 设备上进行测试。只需在 Play 商店中搜索“phonegap”

标签: android plugins phonegap-plugins barcode-scanner phonegap


【解决方案1】:

在AndroidManifest.xml 文件中添加权限。

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.INTERNET" />

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多