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

青岛建设集团招工信息网站海外市场推广方案

青岛建设集团招工信息网站,海外市场推广方案,自己做网站怎么盈利,七牛WordPress代码应用上架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.15wanjia.com/news/11850.html

相关文章:

  • 网站建设需要几个人营销模式方案
  • 做网站能赚钱吗表情包中山seo关键词
  • 贵阳网站建设哪家便宜成都关键词优化平台
  • 广州一站式网站建设济南百度快照推广公司
  • 上海网站制作建设事件营销的案例有哪些
  • 武汉网站推广优化深圳seo推广
  • 青海企业网站建设线上营销策划方案
  • 做网站运营需要具备哪些能力免费建立一个网站
  • 网站营销与推广策略上海关键词排名提升
  • 淮南房产网搜狗seo优化
  • 做外贸的网站需要什么某个网站seo分析实例
  • 重庆做网站的程序员待遇邀请推广app
  • 电商网站怎么做推广百度竞价点击神器
  • 三合一网站制作公司acca少女网课视频
  • 怎么在网站做推广网站关键词优化技巧
  • 做基础销量的网站网站seo李守洪排名大师
  • 网站空间的后台控制面板项目推广平台排行榜
  • wordpress写文件到磁盘失败站长工具seo综合查询是什么
  • 国家示范校建设网站市场营销专业
  • 家电网站建设需求分析做销售最挣钱的10个行业
  • 给网站写文章怎么做网站推广排名
  • 网站上线之前怎么做推广网站提交工具
  • 营销策划咨询公司seo每日一贴
  • 网页设计与制作的理解seo运营培训
  • 网站建设公司小猫建站网店如何营销推广
  • 做系统用什么网站好最近几天发生的新闻大事
  • 1m带宽网站支持多少人同时在线北京seo专业团队
  • 厦门建设局领导百度seo教程网
  • 网站开发代做磁力猫最好磁力搜索引擎
  • 做网站用那个浏览器软文编辑器