0
votes

I try to create a hybrid Worklight app to aggregate multiple external Portal pages. There is a tab bar and each view in the tab bar loads its own WebView to display a different Portal page. This works fine and I have everything running but Worklight does not load in the Webviews. I want to access Cordova features like the camera inside the Portal pages.

Worklight initializes fine when I load a Portal page directly in the master Webview, but it does not load in an embedded Webview, i.e. all necessary Worklight files are there and the Portal page is set up right.

I enhanced this example:
http://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v506/09_06_Integrating_server_generated_pages_in_Worklight_applications.pdf

This is the important part of the code:

webViewOverlay = new WebView(this);
webViewOverlay.setWebViewClient(webViewClient);
webViewOverlay.setWebChromeClient(new WebChromeClient());
webViewOverlay.getSettings().setJavaScriptEnabled(true);
webViewOverlay.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webViewOverlay.clearCache(true);
webViewOverlay.loadData(""http://mymielke.de/test/portal/test.html"", "text/html", "UTF-8");
1

1 Answers

0
votes

At least from reading your text, it sounds - to me - like what you're trying to accomplish is nothing like the sample you are basing it on?

The sample is a Worklight Hybrid app with three tabs, the first two simply load some HTML and JavaScript resources that are bunnled in the app (hence are in the Worklight instance and can use whatever the app holds in it, including PhoneGap functionality), and the third third tab is a WebView Overlay that loads an external website.

If this external website wants to access device features using PhoneGap, then PhoneGap needs to be local to the website that is hosted in the external server; Worklight-provided functionality (this includes PhoneGap), will not be available to this external website.

But, then you write:

Worklight initializes fine when I load a Portal page directly in the master Webview, but it does not load in an embedded Webview, i.e. all necessary Worklight files are there and the Portal page is set up right.

Where is "there"? On the external server? There is no reason for Worklight to function this way, as it is outside of the Worklight app scope. You cannot expect to have "multiple" Worklight applications within the same application, loaded so-called remotely(?). (well, you can expect it if you want to :), but it doesn't work that way...)

Have I understood you correctly? If not, feel free to edit your question and make it clearer.