wildabeast / BarcodeScanner

Official repository now at [phonegap/phonegap-plugin-barcodescanner](http://github.com/phonegap/phonegap-plugin-barcodescanner).
966 stars 739 forks source link

APP crashes when trying to encode text #247

Open dominosoft opened 9 years ago

dominosoft commented 9 years ago

Hi people, i'm trying to encode (create a QR) using this plugin, but every time i call a function like this one, the app crashes and exits, any idea why?:

function createQR(txt){ cordova.plugins.barcodeScanner.encode(cordova.plugins.barcodeScanner.Encode.TEXT_TYPE, txt, function(success) { alert("encode success: " + success); }, function(fail) { alert("encoding failed: " + fail); } ); }

I'm using it on phonegap version 4.2.0-0.24.0, and the app is running on an Android 4.4 phone. thanks!

duindain commented 9 years ago

I have this same issue with phonegap 4.2.0-0.24.2 cordova 4.3.0 barcodescanner 2.0.1 using 4.4.4 android phone as soon as encode is called the app crashes

Using this code

var scanner = cordova.require("cordova/plugin/BarcodeScanner");
scanner.encode(scanner.Encode.TEXT_TYPE, "http://www.nhl.com", function(success) {
        alert("encode success: " + success);
    }, function(fail) {
        alert("encoding failed: " + fail);
    });

Scanning does work ok with similar code

scanner.scan(function (result) 
    {
        callback(result.text, result.format, result.canceled);
        alert("scanBarcode: We got a barcode\n" +
                "Result: " + result.text + "\n" +
                "Format: " + result.format + "\n" +
                "Cancelled: " + result.cancelled);
    }, 
    function (error) {
        alert("scanBarcode: Scanning failed: " + error);
    });

I found this post https://github.com/wildabeast/BarcodeScanner/issues/71 detailing the issue I tried their solution but it didn't fix the issue I removed the library, re-added it made the change then built and deployed

Cheers

reconka commented 9 years ago

Encode is not working currently,
If you want to create qr code you should use some external libary like: http://davidshimjs.github.io/qrcodejs/ http://jeromeetienne.github.io/jquery-qrcode/

chrisrhymes commented 9 years ago

Having the same problem encoding. Do you know of any other alternatives that don't rely on jQuery? Thanks.