on 06-22-2015 5:04 PM
Hi,
I am trying to run my SAP UI5 Applcations which use native functionality (Barcodescanner) from the Fiori Launchpad inside the Fiori Client.
However the cordova/Kapsel plugins can't be called from the Application when launched from the Fiori Launchpad.
When the Application URL instead of the Launchpad URL is entered inside the Fiori Client the cordova/Kapsel plugins work.
Also the navigation with the Fiori Launchpad is working.
How do I use native functionality from an Application inside the Fiori Client which is launched from the Fiori Launchpad?
My App is based on a component and I'm launching my App with the following URL:
/sap/bc/ui5_ui5/my_ui5_app?SAPUI5.Component=<YOUR_APP_COMPONENT_NAME>
like described here:http://help.sap.com/saphelp_uiaddon10/helpdata/en/b7/999de9e8be4fa584f99a1082830a32/content.htm
Best regards and thank you
Ralf
Hi Ralf,
I am getting the same error "cordova is not defined"
Did you managed to solve this problem?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Serkan,
I am sorry I didn't find a solution for the problem (due to limited time and an integration in the launchpad wasn't a requirement). The "deviceready" event was definitely fired.
Maybe you could try to debug the application like Daniel suggested in his last reply. I'm guessing that it is a configuration error either of the App or the way the App is called from the launchpad.
If you find a solution it would be great if you could share it.
Best Regards
Ralf
Hi Ralf,
After writing to you i found the solution.
Added windows.parent before cordova to reach the launchpad level.
try {
window.parent.cordova.plugins.barcodeScanner.scan(
function(result){
var itm = new sap.m.ObjectListItem({
title : result.text,
number : result.format,
});
view.barcodeList.addItem(itm);
},
function(error){
alert(error);
}
);
} catch (err) {
alert('error: ' + err.message);
}
Hi Srinivas,
as Serkan already mentioned make sure are you running your Application inside a Kapsel/Cordova Container like the Fiori Client:
SAP Fiori Client – Windows Apps on Microsoft Store
In the WebIDE it's working because there is the Cordova Facade to test some of the plugins:
SAP Web IDE Hybrid App Toolkit Add-on
If you want to run your application only in the browser you might check out this solutions only using JavaScript:
QuaggaJS, an advanced barcode-reader written in JavaScript
Best Regards
Ralf
Hi Serkan / Ralf,
I have tested the app in Fiori Client but not working Barcode functionality, Below are the version details.
Fiori client Version : 1.4.0
Device Android Version : 5.0
Please check below link:
SAP Fiori Client Feature Matrix - SAP Library
Could you please help me any other versions of Android devices, the app will work with barcode functionality?
Regards,
Srinivas
Hi Srinivas,
are you using the URL to the Fiori Launchpad as the SAP-Fiori-URL to initialize the Fiori Client?
Then it should work with:
window.parent.cordova.plugins...
If the SAP-Fiori-URL is the URL to the Application then it should just be:
cordova.plugins...
Could you try if it works without using the launchpad?
Best Regards
Ralf
I did just test this internally at SAP so may be an issue on how the UI5 application is coded. Unfortunately, I am not a UI developer. You can try and capture a Fiddler trace, but not sure what it may show. Examples on how to configure this are found: http://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/ConfigureForAndroid http://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/ConfigureForiOS http://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/DecryptHTTPS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kevin,
as I already mentioned the application works correctly inside the Fiori Client when it isn't launched by the Fiori Launchpad. I assume the problem is how the Launchpad starts the application.
At some point in my code I check if cordova is available with:
if (cordova.plugins.barcodeScanner) { ...
and then the I get this error:
"cordova is not defined"
Best Regards
Ralf
I understood. I tested from a tile application inside Fiori Launchpad on an internal site and from using a direct URL to the UI5 app, both worked correctly. This is why I believe it is something in your UI5 code. I am asking some UI5 developers to see if they may provide some insights.
Thanks,
-kevin
When are you making this check? One reason you may see that is if is happening before the deviceready event fires.
function init() { |
if (sap.Logger) { |
|
} |
|
} |
If you build the Fiori Client using the SMP SDK, you can then connect to it with the Web Inspector. The version of the Fiori Client downloaded from the app stores cannot be debugged using Web Inspector.
That might provide some more details as to why the cordova plugins are not being loaded.
Here are some additional links that may be of help.
If you happen to be proxying your Fiori App through an SMP server, there is an option to disable mobile qualities or plugins such as the Bar Code Scanner.
Hope that helps,
Dan van Leeuwen
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.