cancel
Showing results for 
Search instead for 
Did you mean: 

Fiori Launchpad inside the Fiori Client - use cordova/Kapsel plugins

0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi Ralf,

I am getting the same error "cordova is not defined"

Did you managed to solve this problem?

0 Kudos

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

Former Member
0 Kudos

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);

}

Former Member
0 Kudos

Hi Serkan/ Ralf,

I have added the above code in my view.js file but issue was not resolved.

In SAP WebIDE environment it is working fine but in Launchpad getting error with "cordova not defined".

Could you please help me on this ASAP.

Regards,

Srinivas

sozcan
Explorer
0 Kudos

Hi Srinivas,

If you are using IOS9 installed device you can get this error too.  window.parent statement is not working on IOS9

Former Member
0 Kudos

Hi Serkan,


I am not running the application on IOS 9 Device

I want to run the application in SAP Fiori Launchpad on Desktop/Laptop.


Regards,

Srinivas



sozcan
Explorer
0 Kudos

Sorry Srinivas, Cordova plugins only works in Fiori Client and some of them in SAP WebIDE development environment.

0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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

Answers (1)

Answers (1)

Kevin_SAP
Advisor
Advisor
0 Kudos

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

0 Kudos

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

Kevin_SAP
Advisor
Advisor
0 Kudos

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

Kevin_SAP
Advisor
Advisor
0 Kudos

When are you making this check?  One reason you may see that is if is happening before the deviceready event fires.

  1. document.addEventListener("deviceready", init, false);

function init() {

if (sap.Logger) {

  1. sap.Logger.setLogLevel(sap.Logger.DEBUG); //enables the display of debug log messages from the Kapsel plugins.
  2. sap.Logger.debug("Log level set to DEBUG");

}

  1. sap.Logon.init(logonSuccessCallback, logonErrorCallback, appId, context);

}

0 Kudos

Hi Kevin,

could you please provide more information on how exactly you call the SAP UI5 Application.

Just to make sure in the configuration of the static tile in navigation you just have entered the relative path to the application and nothing more?

Best Regards and thank you,

Ralf

Kevin_SAP
Advisor
Advisor
0 Kudos

Ralf,

Sorry, I support the Fiori Client/Kapsel container and don't work with Launchpad that much.  Perhaps one of the Launchpad or UI5 developers can provide more insight to that.

Sorry,

kevin

Kevin_SAP
Advisor
Advisor
0 Kudos

Ralf,

Are you building in Web IDE ?  I also found the doc explaining deploying on Launchpad .

Thanks,

Kevin

Dan_vL
Product and Topic Expert
Product and Topic Expert
0 Kudos

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