0

我正在使用 phonegap android 开发 pdf417 条码扫描仪应用程序。我用过这个。我什至使用 nodejs 将 cordova 版本升级到 4.1.2。我也在清单和 config.xml 中授予了权限和功能。但是,当我运行此应用程序时,我收到错误“未捕获的 ReferenceError:未定义 scanWithCustomUIButton”。你能告诉我哪里做错了吗

config.xml 

<feature name="Pdf417Scanner">
    <param name="android-package" value="com.phonegap.plugins.pdf417.Pdf417Scanner"/>
    </feature>

 <plugins>

        <plugin name="Device" value="org.apache.cordova.Device"/> 
        <plugin name="Camera" value="org.apache.cordova.CameraLauncher"/>
         <plugin name="Pdf417Scanner" value="com.phonegap.plugins.pdf417.Pdf417Scanner"/> 
</plugins>

清单.xml

<activity
            android:name="mobi.pdf417.activity.Pdf417ScanActivity"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="mobi.pdf417.activity.Pdf417ScanActivity" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

是我的 index.html,也是我的 index.js

4

1 回答 1

0

你可以使用这个科尔多瓦插件。这是 100% 的工作。

http://docs.scandit.com/group__scanditsdk-cordova-guides.html

<head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name = "format-detection" content = "telephone=no"/>
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width;" />
        <link rel="stylesheet" type="text/css" href="css/index.css" />
        <title>Scandit SDK</title>
    </head>
    <body onload="onBodyLoad()" style="background: url(img/ScanditSDKDemo-Splash.png) no-repeat;background-size: 100%;background-color: #000000">
        <script type="text/javascript" src="cordova.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
        <script type="text/javascript">
            function onBodyLoad()
            {
                document.addEventListener("deviceready", onDeviceReady, false);
            }

        function success(resultArray) {

        alert("Scanned " + resultArray[0] + " code: " + resultArray[1]);

                // NOTE: Scandit SDK Phonegap Plugin Versions 1.* for iOS report
                // the scanning result as a concatenated string.
                // Starting with version 2.0.0, the Scandit SDK Phonegap
                // Plugin for iOS reports the result as an array
                // identical to the way the Scandit SDK plugin for Android reports results.

                // If you are running the Scandit SDK Phonegap Plugin Version 1.* for iOS,
                // use the following approach to generate a result array from the string result returned:
                // resultArray = result.split("|");
            }

            function failure(error) {
                alert("Failed: " + error);
            }

            function scan() {
                // See below for all available options.
                cordova.exec(success, failure, "ScanditSDK", "scan",
                             ["ENTER YOUR APP KEY HERE",
                              {"beep": true,
                              "1DScanning" : true,
                              "2DScanning" : true}]);
            }

            app.initialize();
            </script>

        <div align="center" valign="center">
            <input type="button" value="scan" onclick="scan()" style="margin-top: 230px; width: 100px; height: 30px; font-size: 1em"/>
        </div>
    </body>
于 2014-12-18T06:52:25.453 回答