You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/10/14 20:42:11 UTC

[GitHub] Vaporexpress commented on issue #292: SSL errors handling in Android

Vaporexpress commented on issue #292: SSL errors handling in Android
URL: https://github.com/apache/cordova-plugin-inappbrowser/issues/292#issuecomment-429660652
 
 
   Hi.  FYI Google rejected my App until adds this code:
   On  "**public class InAppBrowserClient extends WebViewClient**":
   
   ```
           // Rejected by Google Play - Failed to validate the certificate chain
           @Override
           public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) {
               final AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(webView.getContext(), R.style.AlertDialogCustom));
               String message = "SSL Certificate error.";
               switch (error.getPrimaryError()) {
                   case SslError.SSL_UNTRUSTED:
                       message = "The certificate authority is not trusted.";
                       break;
                   case SslError.SSL_EXPIRED:
                       message = "The certificate has expired.";
                       break;
                   case SslError.SSL_IDMISMATCH:
                       message = "The certificate Hostname mismatch.";
                       break;
                   case SslError.SSL_NOTYETVALID:
                       message = "The certificate is not yet valid.";
                       break;
               }
               message += " Do you want to continue anyway?";
   
               builder.setTitle("SSL Certificate Error");
               builder.setMessage(message);
               builder.setPositiveButton("continuar", new DialogInterface.OnClickListener() {
                   @Override
                   public void onClick(DialogInterface dialog, int which) {
                       handler.proceed();
                   }
               });
               builder.setNegativeButton("cancelar", new DialogInterface.OnClickListener() {
                   @Override
                   public void onClick(DialogInterface dialog, int which) {
                       handler.cancel();
                       closeDialog();
                   }
               });
               final AlertDialog dialog = builder.create();
               dialog.show();
           }
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org