3

I cannot call post request (Https) using webview. In my logcat I find this

[1031/175452:ERROR:ssl_client_socket_openssl.cc(905)] handshake failed; returned 0, SSL error code 5, net_error -107****

It's not working in android 4.3

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115

1 Answers1

8

Quick Fix: Ignore SSL certificate error.

    WebView webview = findViewById(R.id.webView_about_alc);


    webview.setWebViewClient(new WebViewClient() {

        @Override
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            Toast.makeText(AboutAlcActivity.this, description, Toast.LENGTH_SHORT).show();
        }

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

    });

    webview.loadUrl(ALC_ABOUT_PAGE);

-

Better Solution: Fix the Android Network Security Configuration for your project. Follow the below link on how to do so.

https://developer.android.com/training/articles/security-config

Dawit Abraham
  • 1,616
  • 15
  • 19