Software Archive
Read-only legacy content

barcode Scanner just work on IDE

Thiago_G_
Beginner
810 Views

Hello, I`m testing the barcode Scanner resource from Cordova and it is really ok on the XDK IDE, but it doesn`t work on my android.

I removed the intel.XDK.Devices plugin as told on Cordova BarcodeScanner documentation but it didn`t make any efect.

That is my code, thanks in advice.

<!DOCTYPE html>
<html>
<!--
  * Please see the included README.md file for license terms and conditions.
  -->
<head>
    <title>Blank Cordova Mobile App Project Template (Lite)</title>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">

    <!-- see http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/quick-tip-dont-forget-the-viewport-meta-tag -->
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    
    <script src="js/jquery-2.1.4.min.js"></script>
    <script src="js/jquery.mobile-1.4.5/jquery.mobile-1.4.5.min.js"></script>
    <script src="http://debug-software.intel.com/target/target-script-min.js#Rvquow84BZYHUg82EPn3DPC3rar3TCzZM_6NQXS5m04"></script>
    
    <link href="js/jquery.mobile-1.4.5/jquery.mobile-1.4.5.min.css" rel="stylesheet" type="text/css">
    <link href="css/default.css" rel="stylesheet" type="text/css">

    <script src="cordova.js"></script>          <!-- phantom library, needed for Cordova api calls, added during build -->
    <script src="js/app.js"></script>           <!-- recommended location of your JavaScript code relative to other JS files -->
    <script src="xdk/init-dev.js"></script>     <!-- normalizes device and document ready events, see README for details -->

    <script>
        $(document).ready(function(){
            $("#btnConsultarCodigo").click(function(){
                
               console.log("click");
                
                cordova.plugins.barcodeScanner.scan(function(resultado){
                    console.log(resultado);
                    $("#codigo").val(resultado.text);
                }, function(){
                    $("#codigo").val("Erro ao ler o código");
                });
                
            });
        });
    </script>
    
</head>

<body>
    <div role="page">
        <div data-role="header">Crie sua Lista</div>
        
        <div>
            <input type="text" id="codigo">
            <input type="button" id="btnConsultarCodigo" data-role="ui-btn ui-btn-inline" value="Consultar">
        </div>
        
    </div>

</body>
</html>

0 Kudos
4 Replies
PaulF_IntelCorp
Employee
810 Views

Try the barcode scanner sample in the "Start a New Project"?

0 Kudos
Thiago_G_
Beginner
810 Views

Hello.

No i didn`t and i am ashamed for that.

I will try this one now.

 

 

0 Kudos
Michael_O_2
New Contributor I
810 Views

If it doesn't work, try and add com.phonegap.plugins.barcodescanner via the third party plugins.

It has been tested on CLI 4.1.2

0 Kudos
PaulF_IntelCorp
Employee
810 Views

Thiago -- I tried the sample app, using the Debug tab, both with CLI 4.1.2 and CLI 5.1.1 and the sample app worked just fine.

0 Kudos
Reply