Search code examples
androidioscordovabarcode-scanner

PhoneGap 2.7, BarcodeScanner : sharing barcodescanner.js for Android and iOS


I'm trying to use BarcodeScanner Plugin for my webapp with PhoneGap. It's a mobile application for iOS and Android. In my webapp on my server, I have html pages and javascript libraries. I tried to share the barcodescanner.js on my server for my Android and iOS devices, but it doesn't work. I think it's not the same barcodescanner.js for iOS and Android.

How can I use the same barcodescanner.js for all devices ? Or how can I use BarcodeScanner Plugin for all mobile OS (Android and iOS) on my webapp ?

Thanks


Solution

  • From what I've seen, the barcodescanner.js sources looks similar but do contain some subtle differences. You can take a look at the sources here: PG Plugins

    I recommend that you look into rather than using the same JavaScript Source file on your server for both devices to look into PhoneGap Build. For example, in the config file, all you have to do to "inject" the Barcode Scanner plugin into your application is add <gap:plugin name="BarcodeScanner" /> to the config.xml. Then just use PhoneGap Build and it will build the application for all devices. You can read more about it here: PhoneGap Build Plugins.

    Update As mentioned in the comments below viable solution to the specific problem can be found here.