This is a migrated thread and some comments may be shown as answers.

Barcode Scanner Sample code not working

3 Answers 203 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Joel
Top achievements
Rank 1
Joel asked on 08 May 2014, 03:52 AM
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



3 Answers, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 12 May 2014, 02:44 PM
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!

 
0
Alexalexabc
Top achievements
Rank 1
answered on 28 May 2014, 07:08 AM
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.
0
Kaloyan
Telerik team
answered on 30 May 2014, 02:38 PM
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!

 
Tags
General Discussion
Asked by
Joel
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Alexalexabc
Top achievements
Rank 1
Share this question
or