Add phonegap barCode.Scanner plugin

7 views
Skip to first unread message

Arnaud

unread,
Oct 15, 2014, 5:05:23 AM10/15/14
to phon...@googlegroups.com
Hi everyone,

I'm creating an android application, and I need to read barCode or QR-code.

So i'm using this script, really basic:

<script type="text/javascript">

        function scanBarcode(){
            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);
                    }
            )
        }
    </script>

and i call it with that:

        <input type="button" onClick="scanBarcode()" value="Scan"/>

So now I need to add the plugin phonegap which permit that. But my tries failed ( like: cordova plugin add com.phonegap.plugins.barcodescanner, ...). I don't know why. So if someone can help me, and explain me how do it in a good way?
Thanks.
Reply all
Reply to author
Forward
0 new messages