0

我正在开发一个需要二维码扫描的 Buildfire 插件。我使用了下面的代码,它可以在预览器应用程序中运行,但无法扫描 Play 商店中的内置应用程序(仅在 Android 上测试)。

function scan(){
    buildfire.services.camera.barcodeScanner.scan(
        {
            preferFrontCamera : false,
            showFlipCameraButton : true,
            formats : "QR_CODE", // default: all but PDF_417 and RSS_EXPANDED
        },
        function (err, result) {
            buildfire.notifications.alert("We got a barcode\n" +
                "Result: " + result.text + "\n" +
                "Format: " + result.format + "\n" +
                "Cancelled: " + result.cancelled);
            rcpt = result.text;
            console.log(rcpt);
            document.getElementById("recipient").value = rcpt;
        }
    );
}

带按钮的启动功能。在预览器中工作。内置(android)应用程序失败

4

1 回答 1

0

您需要确保您在查看 API 文档的先决条件部分中请求该BarCodeScanner功能https://github.com/BuildFire/sdk/wiki/Barcode-Scanning-Serviceplugin.json

注意:您的应用将需要硬构建。

我希望这有帮助

于 2019-04-30T17:19:43.580 回答