0

I'm working on a Project, which loads a Webview within native Apps.

The App contains a WebView, which is only loading correctly on old Android Devices (4.1.2). On a new Version (4.4. and higher), the View stays blank.

I tried already to set the mixed content:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
}

But it wont change anything. Same with the handler.proceed() function.

 @Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
    handler.proceed(); // Ignore SSL certificate errors
}

The Website contains a lot of JavaScript, so i tried also different Settings like setDomStorageEnabled and so on... Actually the Environment is a test-server, so the Certificates are created on our own. So I just want to test the app and dont think about publishing and the probably issues. But I don't get an error in logcat, so I really don't know, what else could be wrong and how investigate further.

Henry
  • 2,953
  • 2
  • 21
  • 34
a2hur
  • 167
  • 1
  • 1
  • 11

1 Answers1

0

I can recommend you to debug your newer devices.
Here you have a nice sample. You will be able to debug all request and responses and even look through all of that fantastic JS stuff:)

Yurii Tsap
  • 3,554
  • 3
  • 24
  • 33
  • thanks! technically the error occured because of a deprecated method (StringBufferInputStream). after use of the debugger i saw the message only on an emulator and changed it to the ByteArrayInputStream. Works now! – a2hur Dec 13 '16 at 08:46
  • @a2hur Hm, it's not mentioned in your question. Can you attach that code, because honestly I didn't quite catch that statement about deprecated method. – Yurii Tsap Dec 13 '16 at 09:55
  • Dont working code: `InputStream stream = new StringBufferInputStream(message); //[...]` Working code: `ByteArrayInputStream stream = null; try { stream = new ByteArrayInputStream(JsonFile.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return new WebResourceResponse("text/plain", "UTF-8", stream);` As i asked about the issue, i thoght that i handle the WebView correct and i need just some additionals for newer Android WebView. By using the chrome debugger, i received a NullPointer for my stream-variable. – a2hur Dec 13 '16 at 10:05