PDA

View Full Version : Barcodescanner Switch



Kurt001
9 Oct 2013, 5:27 AM
Hi,

I uploaded a barcodescanner switch to the Market here (https://market.sencha.com/extensions/ext-ux-mgd-device-scanner).

Enables you to use: Ext.device.Scanner.scan()
This works with the PhoneGap plugin: Barcodescanner

When this singleton is instantiated, it will automatically select the correct implementation depending on the current device:


Cordova
Simulator

Cordova implementation will use the barcode plugin. The Simulator implementation will simply return a random fake number.

Example
You can use the scan function to take get a barcode:


Ext.device.Scanner.scan({
success: function(result) {
console.log(result);
},
failure: function(error){
console.log(error)
}
});

sailei1
9 Oct 2013, 10:47 PM
Thanks!

fmoseley
10 Oct 2013, 6:59 PM
Yes thank you for your contribution.

lstolz
21 Mar 2014, 5:39 AM
Thanks for your work.

I hope answering in this thread is ok.
I have some problems by switching from Simulator to Cordova.

I set up a cordova app and add BarcodeReader-Plugin.
This is an excerpt of config.xml:


<feature name="BarcodeScanner">
<param name="android-package" value="com.phonegap.plugins.barcodescanner.BarcodeScanner" />
</feature>


So this seems working.
But the Sencha-App still uses the Simulator-Version of the scanner.

If I force the application to use Cordova-Version I get the following error:


ReferenceError: Can't find variable: cordova


Best


I'm using Cordova 3.4.0-0.1.3 with Sencha Touch 2.3.1 and Sencha Cmd v4.0.0.203.

lstolz
28 Mar 2014, 1:54 AM
For those who have the same problems:

removing:



scanner = cordova.require("cordova/plugin/BarcodeScanner");


with:



scanner = cordova.require("com.phonegap.plugins.barcodescanner.BarcodeScanner");


in Cordova.js fixed the problem.