[英]Why getting SslErrorHandler when uploading app in Google Play Store?
I have uploaded the release APK to Google Playstore, but it is always rejected because of SslErrorHandler
.我已经将发布的 APK 上传到 Google Playstore,但总是因为
SslErrorHandler
被拒绝。
@Override
public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) {
final AlertDialog.Builder builder = new AlertDialog.Builder(Registration.this);
String message = "SSL Certificate error.";
message += " Do you want to continue anyway?";
builder.setTitle("SSL Certificate Error");
builder.setMessage(message);
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();
}
});
final AlertDialog dialog = builder.create();
dialog.show();
}
A workaround is putting handler.proceed() and handler.cancel() in if else解决方法是将 handler.proceed() 和 handler.cancel() 放入 if else
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
if (error.toString().equals("SSLError")) {
handler.cancel();
} else {
handler.proceed();
}
}
Good luck!祝你好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.