cancel
Showing results for 
Search instead for 
Did you mean: 

Is this a bug in the UI5 Element sap.ndc.BarcodeScannerButton ?

janfitzner
Discoverer
0 Kudos
94

i am using the sap.ndc.BarcodeScannerButton and when the user is pressing the button the barcodescanner will open as it is supposed to be. if the user press the back button of the browser / the phone the view navigates to the view before. in the browser this is ok but on the phone the user feels it would be normal to close the barcodescanner with the backbutton of the phone and  it should stay on the view where the button is. But even worse: when i navigate again to the view with the button and press it, the barcodescanner is not opening anymore and this error apperas in the console:
BarcodeScanner.scan: Barcode scanning is already in progress. -

i tried several workarounds but nothing is working. i tried to deactivate the backbutton while the barcodescanner is open, but thats not working in modern browsers anymore. My best attempt was to close the barcodescanner before leaving the view, so it could at least open again, when trying again, but i could not successfully close it. i tried with document.getElementsByClassName('closeButton')[0].click() but it was not working.

any idea?

Accepted Solutions (0)

Answers (1)

Answers (1)

janfitzner
Discoverer
0 Kudos

So this is not changing anything about the back-button functionality. But i found out, i can call this:

 

if (sap.ndc && sap.ndc.BarcodeScanner) {
   sap.ndc.BarcodeScanner.closeScanDialog();
}

 

each time the user is leaving (or entering) the view and then the barcodescannerbutton is working again.