Uncaught ReferenceError: scanWithCustomUIButton is not defined

1.6k views Asked by At

I am developing pdf417 barcodescanner application using phonegap android. I used this . I do even upgraded cordova version to 4.1.2 using nodejs. I have given permission and features in manifest and config.xml also. But when I run this application I am getting error ' Uncaught ReferenceError: scanWithCustomUIButton is not defined'. Can you tell me where I am doing wrong

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>

manifest.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>

this is my index.html and is my index.js

1

There are 1 answers

4
Nurdin On BEST ANSWER

You can use this cordova plugin. It's 100% working.

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>