cancel
Showing results for 
Search instead for 
Did you mean: 

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

Firoz_Ashraf
Contributor
0 Kudos

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.

Accepted Solutions (0)

Answers (4)

Answers (4)

周建华
Participant
0 Kudos
周建华
Participant
0 Kudos

Did you succeed?

Ryan-Crosby
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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