当前位置: 首页 > news >正文

青岛建设集团招工信息网站网站注册域名

青岛建设集团招工信息网站,网站注册域名,网站设计一般包括哪些,设计类专业分类应用上架GooglePlay 收到邮件提示 出现这个原因是因为我在app中使用webview加载Https的H5界面,在onReceivedSslError()中处理SslErrorHandler时,出现白屏现象,原因是webview默认在加载有证书验证的url时,会默认使用handler.cancel…

应用上架GooglePlay 收到邮件提示

 

出现这个原因是因为我在app中使用webview加载Https的H5界面,在onReceivedSslError()中处理SslErrorHandler时,出现白屏现象,原因是webview默认在加载有证书验证的url时,会默认使用handler.cancel()进行拦截操作,这里只需要改成handler.proceed()。

2种解决方式

1.常规解决方式 :

出现在错误的时候让用户同意

final AlertDialog.Builder builder = new AlertDialog.Builder(HomeWebActivity.this);
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("continue", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialog, int which) {handler.proceed();}
});
builder.setNegativeButton("cancel", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialog, int which) {handler.cancel();}
});
final AlertDialog dialog = builder.create();
dialog.show();

2.第二种加载https 证书

证书一般常规可以问前端或者后端要。参考 从网页中获取Ssl证书_NextWarm的博客-CSDN博客)拿到将证书(.cer文件)复制到应用程序的res / raw文件夹中

private static final int[] CERTIFICATES = {R.raw.cardhobby,   // you can put several certificates
};
private ArrayList<SslCertificate> certificates = new ArrayList<>();private void loadSSLCertificates() {try {CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");for (int rawId : CERTIFICATES) {InputStream inputStream = getResources().openRawResource(rawId);InputStream certificateInput = new BufferedInputStream(inputStream);try {Certificate certificate = certificateFactory.generateCertificate(certificateInput);if (certificate instanceof X509Certificate) {X509Certificate x509Certificate = (X509Certificate) certificate;SslCertificate sslCertificate = new SslCertificate(x509Certificate);certificates.add(sslCertificate);} else {}} catch (CertificateException exception) {} finally {try {certificateInput.close();inputStream.close();} catch (IOException e) {e.printStackTrace();}}}} catch (CertificateException e) {e.printStackTrace();}
}

binding.webview.setWebViewClient(new WebViewClient() {public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {//handler.cancel(); // Android默认的处理方式// handler.proceed();  // 接受所有网站的证书//handleMessage(Message msg); // 进行其他处理SslCertificate serverCertificate = error.getCertificate();Bundle serverBundle = SslCertificate.saveState(serverCertificate);for (SslCertificate appCertificate : certificates) {if (TextUtils.equals(serverCertificate.toString(), appCertificate.toString())) { // First fast checkBundle appBundle = SslCertificate.saveState(appCertificate);Set<String> keySet = appBundle.keySet();boolean matches = true;for (String key : keySet) {Object serverObj = serverBundle.get(key);Object appObj = appBundle.get(key);if (serverObj instanceof byte[] && appObj instanceof byte[]) {     // key "x509-certificate"if (!Arrays.equals((byte[]) serverObj, (byte[]) appObj)) {matches = false;break;}} else if ((serverObj != null) && !serverObj.equals(appObj)) {matches = false;break;}}if (matches) {handler.proceed();return;}}}

http://www.tj-hxxt.cn/news/99628.html

相关文章:

  • 小红书推广怎么做南京百度seo排名优化
  • 如何免费网站建设友情网
  • 最权威的做网站设计公司价格广州网站seo地址
  • 浙江网站建设推广快优吧seo优化
  • 专业网站设计公司地址网络营销包括哪些
  • 未来商城网站建设软件开发培训中心
  • gta5网站正在建设中搜索引擎推广试题
  • 做网站的属于什么专业?seo黑帽技术
  • 做网站什么意思注册公司
  • 兰州发布紧急通知宁波seo整站优化
  • 做室内效果图的网站如何在百度上投放广告
  • 许昌市住房和城乡建设部网站百度下载2022新版安装
  • 搭建网站源码系统优化软件排行榜
  • java做博客网站有哪些网络营销策划方案格式
  • 网站备案帐号网络推广招聘
  • 互联网企业网站广告网
  • 沟通交流类网站有哪些成都关键词seo推广平台
  • 受欢迎的佛山网站制作百度收录好的免费网站
  • 百度公司做网站吗他达拉非片和伟哥区别
  • 淘宝特价版福州seo招聘
  • 做网站不给维护属于诈骗吗搜索引擎优化关键字
  • 怎样在谷歌做网站谷歌seo是什么职业
  • 网站建设利润seo优化关键词0
  • 竞价单页网站制作免费网站推广软文发布
  • 每日新闻一天热点全知道珠海百度seo
  • 网站群建设方案网络营销与管理专业是干什么的
  • 陕西建设网站官网重庆网站推广软件
  • 免费代刷网站推广快速山西seo顾问
  • 郑州做网站的专业公司网站优化排名金苹果下拉
  • 贵州高端网站开发百度关键词排名手机