Barcode Scanner Sample code not working

4 posts, 0 answers
  1. Joel
    Joel avatar
    2 posts
    Member since:
    Jan 2012

    Posted 07 May 2014 Link to this post

    Hi

    I've tried the barcode scanner sample application here http://docs.telerik.com/platform/appbuilder/sample-apps/sample-barcode-scanner

    Which i had to import into a new project because the project file was old

    And also tried this article here http://blogs.telerik.com/appbuilder/posts/13-07-03/using-the-barcode-scanner-plugin-with-icenium

    Which is referring to version 0.3 when the current version is 1.1

    Both of them i have the same result on various Android devices I've tried, the button does nothing when pressed.

    Is there any updated example code for 1.1? any major differences that might be causing this?

    I've herd people complaining about the latest version of barcodescanner (here http://www.raymondcamden.com/index.cfm/2014/3/5/Barcode-Scanner-sample-and-new-repo-for-Cordova-examples) saying it simply doesn't work, is this the case?

    Any suggestions for getting this to work? or sources for other working example code i can use?

    Thanks,
    Joel



  2. Kaloyan
    Admin
    Kaloyan avatar
    872 posts

    Posted 12 May 2014 Link to this post

    Hello Joel,

    Thank you for contacting us.

    Using the AppBuilder Windows Client, I was able to clone the BarcodeScanner sample. Deploying it on Samsung Note 2, also resulted with success as the Scan button ran the scanner correctly on the device. Note, the BarcodeScanner is an integrated inside AppBuilder plugin and at this stage its version is 1.1. If for some reason the sample app does not work on your side, you can follow the next steps in order to use the plugin:
    1. Open an existing AppBuilder project, or create a new one;
    2. Inside it, open the projects properties. You should find them in the Project Navigator pane.
    3. Go to Plugins and enable the BarcodeScanner plugin from within the Integrated Plugins tile.
    4. Then, it should be enough to bind the cordova.plugins.barcodeScanner.scan() function to an event of your choice (e.g., a button click). Something like this:
      scanButton.addEventListener("click",
          function() {
              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);
                  }
                  );
          });

    I have also attached my project for your further guidance. I hope it helps.

    Please, let me know if I have misunderstood the issue in any way or you need further assistance.

    Regards,
    Kaloyan
    Telerik
     

    Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!

     
  3. Alexalexabc
    Alexalexabc avatar
    2 posts
    Member since:
    Aug 2013

    Posted 28 May 2014 Link to this post

    This is impressive, I've been suffering from a similar problem with a .net barcode scanner. I think I got much clues here. However, I also feel curious about the deployment on Samsung Note 2.
  4. Kaloyan
    Admin
    Kaloyan avatar
    872 posts

    Posted 30 May 2014 Link to this post

    Hi Alexalexabc,

    I am glad this helps.

    Further, using Telerik AppBuilder you can deploy applications on devices with a single click. Please, check this articles from our online documentation if you are interested:
    Please, let me know if I can be of a further assistance.

    Regards,
    Kaloyan
    Telerik
     

    Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!

     
Back to Top