【问题标题】:Webview avoid security alert from google play upon implementation of onReceivedSslErrorWebview 在执行 onReceivedSslError 时避免来自 google play 的安全警报
【发布时间】:2016-07-20 04:28:59
【问题描述】:

我收到来自 google play 的安全警报:

您的 APK 因包含违反恶意行为政策的安全漏洞而被拒绝。如果您提交了更新,您的应用的旧版本仍会在 Google Play 上发布。

如果我删除 onReceivedSslError (handler.proceed()),页面将无法打开。 无论如何我可以在 webview 中打开页面并避免安全警报。

而我的网站放入我的应用程序需要 http 或 https 吗?我正在使用http://mywebsite...

【问题讨论】:

  • 您是否已更新到最新的targetPlatform 和/或platformTools
  • 我使用的是最新版本

标签: android


【解决方案1】:

如果您使用 onReceivedSslError 方法,请移除 onReceivedSslError 方法并制作新的 APK。

【讨论】:

  • 如果我删除 onReceivedSslError (handler.proceed()),页面将无法打开。无论如何我可以在 webview 中打开页面并避免安全警报。
【解决方案2】:

将 onReceivedSslError() 更改为:

@Override
public void onReceivedSslError(WebView v, final SslErrorHandler handler, SslError er) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getApplicationContext());
    builder.setMessage("Problem with Security");
    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();
}

希望这会对你有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多