cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] Vaporexpress edited a comment on issue #292: SSL errors handling in Android
Date Sun, 14 Oct 2018 21:08:33 GMT
Vaporexpress edited a comment 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 I added 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_NOTYETVALID:
                       message = "The certificate is not yet valid.";
                       break;
                   case SslError.SSL_EXPIRED:
                       message = "The certificate has expired.";
                       break;
                   case SslError.SSL_IDMISMATCH:
                       message = "Hostname mismatch.";
                       break;
                   case SslError.SSL_UNTRUSTED:
                       message = "The certificate authority is not trusted.";
                       break;
                   case SslError.SSL_DATE_INVALID:
                       message = "The date of the certificate is invalid.";
                       break;
                   case SslError.SSL_INVALID:
                       message = "A generic error occurred.";
                       break;
                   case SslError.SSL_MAX_ERROR: /* Deprecated in API level 14*/
                       message = "The number of different SSL errors.";
                       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


Mime
View raw message