Skip to Content

SAPUI5 Bar Code Scanner App on FIORI Client - Camera opens but scan does not gives the result

Hi,

I have created a SAPUI5 app for bar code scanner using cordova plugin.

When I deploy it on FIORI Launchpad and try to run the app. then the camera opens to read the bar code but it does not gives the result of the scanned code.

Any help please?

Following are the screen shots of my code (on Eclipse)

Index:

View:

Controller:

Here are the screen shots of the app. on the FIORI Launchpad.

After opening the camera, it looks for the bar code but does not transfers this data back to the screen.

Is there something that I am missing?

Any help would be highly appreciated.

Regards,

Firoz.

view.jpg (59.7 kB)
index.jpg (174.7 kB)
controller.jpg (60.9 kB)
fiori.jpg (35.8 kB)
app.jpg (9.9 kB)
camera.jpg (55.1 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Sep 27, 2017 at 03:26 AM

    here is my controller code

    onButtonPressed:function(){
    					jQuery.sap.require("sap.ndc.BarcodeScanner");
                    sap.ndc.BarcodeScanner.scan(
    				   function (mResult) {
    				      alert("We got a bar code\n" + 
    				            "Result: " + mResult.text + "\n" +
    				            "Format: " + mResult.format + "\n" +
    				            "Cancelled: " + mResult.cancelled);
    				   },
    				   function (Error) {
    				      alert("Scanning failed: " + Error);
    				   },
    				   function (mParams) {
    				      alert("Value entered: " + mParams.newValue);
    				   }
                    );
    }

    And I also have a question , I use the SAP WEB IDE to create my project , in my project I use the HAT and cordova , I try to run my APP in Web application and Android device can achieve effect , turn on the camera and read the result , but when I deploy it to my fiori lanuchpad , I will recive a tips to tell me my device camera is unavailable , I guess it's the cordova and HAT environment got wrong , but I don't know how to put the cordova in the SAP fiori launchpad

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 27, 2017 at 12:43 PM

    Hi,

    Based on the camera screenshot that you have shared it looks like you are not focusing closely on the barcode for which you intend to scan. At a minimum you likely need more focus on the barcode image than is currently shown from the screen catpure. It is hard to see from the image but you may also need to enlarge the barcode print out so the camera can properly distinguish the width of the bars/spaces and decode the information properly. You would also generally be more successful to run this on a newer mobile device with a better camera than the webcam that you are using in HAT.

    Regards,

    Ryan Crosby

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 24, 2017 at 08:28 AM

    Did you succeed?

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 24, 2017 at 08:37 AM
    Add comment
    10|10000 characters needed characters exceeded