WebView - onReceivedHttpAuthRequest永远不会停止

时间:2017-01-04 10:39:33

标签: android webview

我在Android webview应用程序中遇到了一个死循环,该应用程序在onReceivedHttpAuthRequest函数上被阻止。

mWeb.setWebViewClient(new WebViewClient() {
   @Override
   public void onPageFinished(WebView view, String url) {
       mProgressBar.setVisibility(View.GONE);
   }

   @Override
   public void onReceivedHttpAuthRequest(WebView view,HttpAuthHandler handler, String host, String realm) {
           if (isAdded())
               handler.proceed(getResources().getString(R.string.username), getResources().getString(R.string.pass));
   }

   @Override
   public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
       handler.proceed();
   }
});
mWeb.loadUrl(mUrl);

1 个答案:

答案 0 :(得分:0)

活动

node_modules

在WebViewClient上



    mWebView.LoadUrl(url);
    await Task.Delay(10000);                            
    if (!mWebView.IsShown | cliente.ErroReportado)
    {
        Toast t = Toast.MakeText(Android.App.Application.Context, "Erro ao acessar o servidor, verifique conexão, usuário e senha e tente novamente!", ToastLength.Long);
        t.SetGravity(GravityFlags.Center, 0, 0);
        t.Show();
        OnCreate(null);
    }
    }