Search code examples
androidwebviewssl-certificatewebviewclient

Why does Android 2.2 throws security warning where as Android 4.2 won't?


Recently I was working on loading url in WebView, the url loads fine without any issue on Android 4.2 but when I run the same code on android 2.2 it throws error, to track the error I override the method in my WebViewClient

@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler,
                SslError error) {
            super.onReceivedSslError(view, handler, error);
            handler.proceed();
        }

To check if there is issue in my code, I pasted same url in Android 4.2 browser, worked fine but when I paste it in android 2.2 browser it shows error dialogue ( See the image ), any help appreciatedenter image description here


Solution

  • Different Android versions include different CA certificates. Android 4.2 included 100 CA certificates but probably Android 2.2 did not include the one valid for the URL you are visiting.

    You can verify the list of trusted certificates in your phone settings.