0 Replies Latest reply on Sep 27, 2017 5:28 AM by russellkef

    First phonegap project - some clarification please

    russellkef

      I am 'almost ready' to upload my first phonegap project for 'conversion' but I am unsure on a number of things - TBH have read the docs etc and I'm still none the clearer.

       

      OK so config.xml - hopefully I can achieve that

       

      What I cannot get my head round is/are plugins and how to actually integrate them in the project js file and then use them.

       

      I have a need to use the barcode reader - to read a QR image then decode that to get the QR code data (a URL).  These QR codes will be printed and on display on various locations with each QR code for a different URL.

       

      What I understand/see is the 'sample code' from - phonegap/phonegap-plugin-barcodescanner

       

      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);

        },

        {

        preferFrontCamera : true, // iOS and Android

        showFlipCameraButton : true, // iOS and Android

        showTorchButton : true, // iOS and Android

        torchOn: true, // Android, launch with the torch switched on (if available)

        saveHistory: true, // Android, save scan history (default false)

        prompt : "Place a barcode inside the scan area", // Android

        resultDisplayDuration: 500, // Android, display scanned text for X ms. 0 suppresses it entirely, default 1500

        formats : "QR_CODE,PDF_417", // default: all but PDF_417 and RSS_EXPANDED

        orientation : "landscape", // Android only (portrait|landscape), default unset so it rotates with the device

        disableAnimations : true, // iOS

        disableSuccessBeep: false // iOS and Android

        }

        );

       

      Now am I right in thinking that all I need do is call the function cordova.plugins.barcodeScanner.scan() from an onlick() ?

       

      Also I need to have an scr folder so my tree would look like this - is this OK?

       

      • index.html
      • config.xml
        • js (folder)
          • app js files
          • vendor (folder)
        • css (folder)
        • scr (folder)
        • res (folder)
          • ios (folder)
          • android (folder)

       

      Thanks in advance