Hello,
I’m using the sap.ndc.BarcodeScannerButton for the barcode scanning. It is working fine on the fiori client.
But I want to hide the button if scanning is not possible (like on a desktop browser). I set therefore the property provideFallback to false, but the button is still visible. When I click on the button then the fallback popup appears and says that the scanner is not available. How can I hide the button if scanning is not possible?
<ndc:BarcodeScannerButton scanSuccess="onScanSuccess" provideFallback="false" />

I tested also the sap.ndc.BarcodeScanner.getStatusModel method. It returns always available = true.
I have additional an issue with the cancelation of the scanning. If the user cancels the scanning then also the fallback popup appears where the user can enter the value manual. Is it possible to skip this popup?
Request clarification before answering.
You can create a JSON model with device information like this
var oModel = new JSONModel(Device);
oModel.setDefaultBindingMode("OneWay");
this.setModel(oModel, "device");
and than in your XML you can hide the button if
{device>/system/desktop}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Emanuele,
thank you very much for your replay.
I know that I can check the device type. But I also must distinguish between the fiori client and the browser on the phone / tablet. I hopped that this API will check this.
Is there another way to check if the fiori client (cordova) or the kapsel plugin is running?
Best regards
Frank
Got it. So I think that the only thing you can do is to have two different apps, one deployed with cordova lib that shows the button and another one that is not embedding cordova and so does not have the button.
I don't think you can handle it in another way.
Are you using WebIDE to deploy this application?
We are using WebIDE to deploy the app. But our app is very complex. It has 48 views. The effort to maintain 2 apps is not in the relation to hide a button. If I don't find another solution then I will hide the button based on the the device type. So if a user calls the app on the phone browser then he will see the fallback popup.
I've never tested it because right now I've no time to setup this kind of example but what you could do is this.
On the startup of your app, print in a dialog the JSON of the Device object (what I've showed to you in the comment) and compare that info between the version embedded in the app and the one opened by the browser on the phone.
Than you should check if you have some value to play with to show/hide the button.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.