Home:ALL Converter>IBM Worklight/Cordova does not load in embedded WebView in Worklight on Android

IBM Worklight/Cordova does not load in embedded WebView in Worklight on Android

Ask Time:2013-05-03T23:50:53         Author:Frank Mielke

Json Formatter

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

Author:Frank Mielke,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/16362932/ibm-worklight-cordova-does-not-load-in-embedded-webview-in-worklight-on-android
yy