The previous articles in this tutorial are a small series around SAP ui5 and Cordova:
- SAP ui5 application development tutorial 48 – how to develop barcode scanning function in SAP ui5 application-The sap ui5 application developed through the steps described in this article can only run normally in the desktop browser. Under the authorization of the user, turn on the camera of the laptop.
- SAP ui5 application development tutorial 49 – how to debug SAP ui5 applications running on mobile phones on desktop computers
- SAP ui5 application development tutorial 50 – how to use Cordova to generate SAP ui5 applications into a hybrid application that can be installed on Android Phones
- SAP ui5 application development tutorial 51 – how to use chrome to debug SAP ui5 Cordova hybrid applications running on mobile phones-If an SAP ui5 application uses
sap.ndc.BarcodeScanner
, and throughCordova
Build and package, generate APK files and install them on Android phones. When running on your phone, clickScan
Button, still can’t pop up the mobile camera scanning interface we expect to see. Through debugging, it is found that this is due tosap.ndc.BarcodeScanner
In the internal implementation of, it will be detected firstcordova.plugins.barcodeScanner
Available. When and only when we package SAP ui5 application into Cordova application, we explicitly add`When this Cordova plugin is added to the project,
cordova. plugins. Barcodescanner ` will be given the correct value.
The rest of this article describes how to enable in a Cordova applicationcordova-plugin-barcodescanner
.
The effects achieved are as follows:
choiceOnly allowed when using this app
Just.
Before we allow this request, hellocordova is applied on the mobile phoneset up
In the panel, in thejurisdiction
It shows thatNo permission required
:
After allowing the Cordova app to request a camera application,jurisdiction
The panel displays as follows:
Now you can use the mobile camera to scan the bar code:
The interface of successful scanning is shown in the following figure:
Refer to this article for detailed stepsarticle。