This week I started to read about running SAPUI5/OpenUI5 in Cordova. As I am using WebStorm by IntelliJ for developing JavaScript code on my MAC, I followed IntelliJ’s WebStorm page (google for “Using PhoneGap/Cordova”) to setup the necessary plugins. Basically, node.js and cordova are needed and can be downloaded and installed easily.

WebStorm is a great IDE and allows to create an empty Cordova project with one click. In the project structure, at least one folder catches someone’s eye: “www”. This is the place to store your SAPUI5 code. I downloaded the OpenUI5 “UI5 Runtime Mobile” pack, extracted it to the www folder (in a subfolder of course) and created a simple index.html file bootstrapping SAPUI5 and added cordova.js to be loaded, too.


When running this setup in your local browser, it will fail to load cordova.js as this file will be added to the output folder (myProject/platforms/android/assets/www” when you build your project using the command “cordova build android”. It is not part of the “myProject/www” folder.


I also added a reference to index.js file, in which I am handling the load events. All further processing (defining the paths, creating the app, etc) should be done whenever the event “onDeviceReady” has been fired to ensure that all libraries have been loaded completely.


Basically, decide upfront whether to use cordova or phoneGap and stick to this decision to avoid ugly side effects.


Cordova apps can be debugged in the desktop browser to some extend (calling the native code of course) but you need to copy the relevant js files (e.g. cordova.js) to the www folder (or create a symlink).

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Pascal Schmidt-Volkmar Post author

    Basically, it is necessary to decide upfront, which framework should be used. In order to avoid issues later, one should stick either to cordova or phoneGap and do not mix both.

    (0) 

Leave a Reply