Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
977 views
in Technique[技术] by (71.8m points)

ssl certificate - What is the alternate for onReceivedSslError() in Webview?

I am working on app that will connect user with available open WIFIs by providing their landing pages (having login option) in the app. Google is showing alert for using onReceivedSslError() in WebView for loading Wifi's landing page in the app.

If I remove this method then link will not work. In order to make it functional I need to add the domain name in the network_security_config.xml file but I do not know which link will be shown by wifi's vendors as it is not in my control. This insist me to use onReceivedSslError() method in Webview. I am showing alert dialog inside onReceivedSslError() to ask user if he wants to continue or not.

 AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage("SSL Certificate Verification!
Please click on CONTINUE to open login 
page of selected Wifi");
        builder.setPositiveButton("continue", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                handler.proceed();
            }
        });
        builder.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                handler.cancel();
                finish();
            }
        });
        final AlertDialog dialog = builder.create();
        dialog.show();` 

Error getting inside onReceivedSslError()

error.getPrimaryError() : 3 SSL_UNTRUSTED

I have tried this too https://www.rgagnon.com/javadetails/java-fix-certificate-problem-in-HTTPS.html but again not working .

Any available link is not solving my issue. Kindly guide me. Thanks in advance

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...