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

Cordova.Plugins.barcodeScanner undefined

5 Answers 181 Views
Apache Cordova
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ken
Top achievements
Rank 1
Ken asked on 20 Jan 2016, 01:59 PM

I have a mobile app that I have written that utilizes the barcodescanner plugin. It used to work just fine until about a week ago. Now when I run the app in the AppBuilder extension for Visual Studio 2015 I get the following error whenever the barcodescanner is initialized.

"Uncaught TypeError: Cannot read property 'barcodeScanner' of undefined at scripts/esig.js (line: 101)"

 Below is the code used to initialize the scanner:

 scanBarcode: function () {
            cordova.plugins.barcodeScanner.scan(
            function (result) {
               if (!result.cancelled) {
                   app.esigService.viewModel.searchAccountNumber = result.text;
                   app.esigService.viewModel.getPatientByAccountNumber();
               }
            }, ...

 When the app is loaded and then logged into the following code fires:

 onLoad: function () {
            if (app.isAuthenticated) {
                if (app.esigService.viewModel.firstLoad) {
                    app.esigService.viewModel.scanBarcode();
                    app.esigService.viewModel.firstLoad = false;
                    app.esigService.viewModel.getFormGroups();
                }
            }
            else {
                global.app.application.navigate("#home");
            }
        },

The plugin is enabled in the properties of the app. I cannot figure out why I am getting this error. Any help is greatly appreciated.

 

Thank you,

 

Ken S.

 

5 Answers, 1 is accepted

Sort by
0
Ken
Top achievements
Rank 1
answered on 20 Jan 2016, 04:05 PM

Also here is the Log Output from the AppBuilder. Maybe this will help.

[2016-01-20 07:48:02.115] Log (Exception,High): System.ArgumentException: Plugin with given ID was not found in marketplace.
   at OperationExecutorExtensions.<RequestAsyncCore>d__11`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at OperationExecutorExtensions.<RequestAndParseAsync>d__1f`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Telerik.BlackDragon.Client.Modules.Cordova.ViewModels.PluginViewModelProvider.<SetMarketplacePluginVariables>d__16.MoveNext()

0
Aleksandar Hitrov
Telerik team
answered on 22 Jan 2016, 05:28 PM
Hello Ken,

I suspect that the issue you are reporting is due to us removing a version of the BarcodeScanner plugin from our Marketplace plugins repository.

Updating the BarcodeScanner plugin version to the latest (the latest version is currently 2.0.0) should fix this. You can change by following theses steps:
1.) Right-click on the project in the Solution explorer
2.) Select Manage Packages
3.) In the Manage Packages dialog select the Plugin Marketplace tab
4.) Select the BarcodeScanner plugin from the plugins list
5.) On the right-hand side of the dialog you should now see the details for the BarcodeScanner plugin
6.) From the version drop-down select 2.0.0 and press the Change button
7.) Re-build and re-deploy your application

If changing the version of the BarcodeScanner plugin is not an option for you or your problem persist even after you've updated the plugin's version to the latest we will need the entire sources of your app in order to investigate further.

Please accept my apology for this inconvenience and let me know if the above steps don't work or you have more questions.

Regards,
Aleksandar Hitrov
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
Ken
Top achievements
Rank 1
answered on 22 Jan 2016, 08:07 PM

Aleksandar,

 

Thank you for your response. However, I have tried updating the plugin from the Plugin Marketplace through the solution that you suggested. I have also uninstalled the app completely and installed it manually by downloading the plugin. Neither option makes any difference at all. Either way I still get the "Uncaught TypeError: Cannot read property 'barcodeScanner' of undefined at scripts/esig.js (line: 101)" as explained above. How do I proceed to the next step of assistance from your team? I need this resolved today if at all possible. Thank you.

 

Ken S.

0
Ken
Top achievements
Rank 1
answered on 25 Jan 2016, 02:46 PM

Hello,

 I am still having the same issue. Does anyone have a solution to this issue? 

 Thank you,

 Ken S.

0
Aleksandar Hitrov
Telerik team
answered on 27 Jan 2016, 02:01 PM
Hi Ken,

Thank you for submitting your issue through our ticketing system. This is this is best way to receive a timely response to any urgent issues. In addition, the Platform Professional subscription you have also entitles you to guaranteed 48 hours response time.

Note that we can’t guarantee a response time in our forums and although we do our best to address all questions, replies might be delayed. This is why I would recommend that you submit a support ticket for any technical issues you need prompt response to. 

Regards,
Aleksandar Hitrov
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
Apache Cordova
Asked by
Ken
Top achievements
Rank 1
Answers by
Ken
Top achievements
Rank 1
Aleksandar Hitrov
Telerik team
Share this question
or