10 Replies Latest reply on Nov 17, 2016 3:28 PM by salvadorr91388860

    cloudSky.zBar.scan failing

    smits15019292 Level 1

      For some reason, every time my app call this function, nothing happens

      And if you call it again it says "Scan is already in progress"

       

      cloudSky.zBar.scan(

        {

        text_title: "OPTIONAL Title Text - default = 'Scan QR Code'", // Android only

        text_instructions: "OPTIONAL Instruction Text - default = 'Please point your camera at the QR code.'", // Android only

        camera: "front" || "back", // defaults to "back"

        flash: "on" || "off" || "auto", // defaults to "auto". See Quirks

        drawSight: true || false //defaults to true, create a red sight/line in the center of the scanner view.

        },

        function (result) {

          alert(result)

        },

        function (error) {

          alert(error);

        }

      )

       

       

      org.madmobile.cordovaplugins.zbarscanner

       

       

      Please help

        • 1. Re: cloudSky.zBar.scan failing
          ryanskihead Adobe Employee

          What platform are you on? Have you tried connecting a debugger to see if any exceptions occur?

           

          I'd also suggest getting in touch with the developers, and posting an issue there -- tough for us to debug their plugin.

          • 2. Re: cloudSky.zBar.scan failing
            smits15019292 Level 1

            The issue is only happening on the iOS version it seems

            • 3. Re: cloudSky.zBar.scan failing
              smits15019292 Level 1

              Using PhoneGap Build

              Here is the URL to download the build Adobe PhoneGap Build

               

              This is what my config.xml says

              <gap:plugin name="org.madmobile.cordovaplugins.zbarscanner" source="npm" />

               

              What am I missing?

              • 4. Re: cloudSky.zBar.scan failing
                VectorP Level 4

                  camera: "front" || "back", // defaults to "back"

                  flash: "on" || "off" || "auto", // defaults to "auto". See Quirks

                  drawSight: true || false //defaults to true, create a red sight/line in the center of the scanner view.

                 

                You didn't really code it exactly this way, did you?

                • 5. Re: cloudSky.zBar.scan failing
                  smits15019292 Level 1

                  To be specific,

                  Here is the code in the app

                   

                   

                    cloudSky.zBar.scan(

                    {

                    text_title: "SCAN BARCODE", // Android only

                    text_instructions: "RED LINE THROUGH THE ENTIRE BARCODE", //  Android only

                    camera: "back", // "front" || "back" // defaults to "back"

                    flash: "auto", // "on" || "off" || "auto" // defaults to "auto". See Quirks

                    drawSight : "true" //  "true" || "false" //default use true, create a red/green sight to center barcode

                    },

                      function (result) {

                      },

                      function (error) {

                      alert("Scanning failed: " + error);

                      }

                    );

                   

                  Which does not have the ||

                  But the || is there in the sample provided on their website

                   

                  The other interesting thing is that the latest release note on npm as per the author was 11 months ago

                   

                  Not sure if PGB uses nightly builds or stable release only

                  Or if there is a way to see and select an older / stable release

                  • 6. Re: cloudSky.zBar.scan failing
                    VectorP Level 4

                    Well, I'm not sure whether or not this is related, but:

                    you have multiple document.ready handlers, and a deviceready eventhandler which is likely to be invoked prior to document.ready. That's very risky, because in your deviceready callback function, you are manipulating the DOM, which may not be completely loaded, yet. This would throw javascript error messages, effectively preventing the scan script to start.

                     

                    You could first try and clean up that construction a bit, in such a way that such unpredictable event handling can't occur.

                     

                    Next: you are correct: the latest plugin release is 11 months ago, and the latest (unanswered) forum entry at their website is from August. It looks like the developers of this plugin are not very active (or may even have given up).

                    I wouldn't even consider picking up an older plugin version...

                    • 7. Re: cloudSky.zBar.scan failing
                      smits15019292 Level 1

                      I tried to run the script directly without even worrying about the binding but it just does not want to work

                       

                      This was working in the same app on our last build/test a few months ago so not sure what changed    

                      • 8. Re: cloudSky.zBar.scan failing
                        VectorP Level 4

                        ...a few months ago...

                         

                        what PGB version did you use then, and what version now?

                        If those are different, you could downgrade to that previous PGB version and retry for test purposes.

                        • 9. Re: cloudSky.zBar.scan failing
                          smits15019292 Level 1

                          Previously it was using 5.2

                          It now uses 6.3

                           

                          Tried reverting to the older version and it still did not work     

                          • 10. Re: cloudSky.zBar.scan failing
                            salvadorr91388860

                            I am using <gap:plugin spec="https://github.com/tjwoon/csZBar" source="git" /> and works just great on Android and iOS.