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 through
CordovaBuild and package, generate APK files and install them on Android phones. When running on your phone, click
ScanButton, still can’t pop up the mobile camera scanning interface we expect to see. Through debugging, it is found that this is due to
sap.ndc.BarcodeScannerIn the internal implementation of, it will be detected first
cordova.plugins.barcodeScannerAvailable. 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 application
The effects achieved are as follows:
Only allowed when using this appJust.
Before we allow this request, hellocordova is applied on the mobile phone
set upIn the panel, in the
jurisdictionIt shows that
No permission required：
After allowing the Cordova app to request a camera application,
jurisdictionThe 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。