Black screen on Android Webview

I wrote a very simple android application to display fullscreen view for a localhost.

When I starting it with url http://192.168.0.99:1880 I see nodered flows same as on browser, But when I go to dashboard page I see only black screen.

If I change url in the code to http://192.168.0.99:1880/ui/#/0 I see the black screen on start.

Part of code:

myWebView.loadUrl("http://192.168.0.99:1880");
myWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.setWebViewClient(new WebViewClient());

PNG

1 Like

Do you mean that if you run it on your phone in the phone's browser it works, but in your app it doesn't?

Which version of Android are you using? I don't think webview supported websockets before Android 4.4. Though actually I am not sure whether the Editor uses sockets so that may be a red herring.

In browser all work fine.

Android 5.1

Don't know then, sorry. Is Add to Home Screen from the browser not good enough? It should go full screen.

Here is debug messages from Android Studio
...
I/chromium: [INFO:CONSOLE(499)] "Rendered http://192.168.0.99:1880/ui/css/app.min.less successfully.", source: http://192.168.0.99:1880/ui/js/app.min.js (499)
I/chromium: [INFO:CONSOLE(499)] "CSS for http://192.168.0.99:1880/ui/css/app.min.less generated in 555ms", source: http://192.168.0.99:1880/ui/js/app.min.js (499)
[INFO:CONSOLE(499)] "Less has finished. CSS generated in 555ms", source: http://192.168.0.99:1880/ui/js/app.min.js (499)
I/chromium: [INFO:CONSOLE(140)] "You are using the ngTouch module.
AngularJS Material already has mobile click, tap, and swipe support...
ngTouch is not supported with AngularJS Material!", source: http://192.168.0.99:1880/ui/js/app.min.js (140)
I/chromium: [INFO:CONSOLE(140)] "SideNav 'left' is not available! Did you use md-component-id='left'?", source: http://192.168.0.99:1880/ui/js/app.min.js (140)
I/chromium: [INFO:CONSOLE(140)] "TypeError: Cannot read property 'getItem' of null
at http://192.168.0.99:1880/ui/js/app.min.js:563:5012
at a (http://192.168.0.99:1880/ui/js/app.min.js:563:5111)
at http://192.168.0.99:1880/ui/js/app.min.js:563:5314
at http://192.168.0.99:1880/ui/js/app.min.js:181:310
at f (http://192.168.0.99:1880/ui/js/app.min.js:66:492)
at http://192.168.0.99:1880/ui/js/app.min.js:69:418", source: http://192.168.0.99:1880/ui/js/app.min.js (140)
I/chromium: [INFO:CONSOLE(499)] "Rendered http://192.168.0.99:1880/ui/css/app.min.less successfully.", source: http://192.168.0.99:1880/ui/js/app.min.js (499)
I/chromium: [INFO:CONSOLE(499)] "CSS for http://192.168.0.99:1880/ui/css/app.min.less generated in 215ms", source: http://192.168.0.99:1880/ui/js/app.min.js (499)
[INFO:CONSOLE(499)] "Less has finished. CSS generated in 215ms", source: http://192.168.0.99:1880/ui/js/app.min.js (499)
...

Solved, need to add in code

setDomStorageEnabled(true);
setJavaScriptCanOpenWindowsAutomatically(true);