Black screen on Android Webview

#1

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

0 Likes

#2

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?

0 Likes

#3

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.

0 Likes

#4

In browser all work fine.

Android 5.1

0 Likes

#5

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

0 Likes

#6

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

0 Likes

#7

Solved, need to add in code

setDomStorageEnabled(true);
setJavaScriptCanOpenWindowsAutomatically(true);

0 Likes