1

如何使用 Wifi Connection 获取强制门户重定向 URL 表单 webview。页面完成上的 Webview 客户端不是调用。所以我没有收到任何重定向页面。任何人有想法请帮助我。

        web.setWebViewClient(new WebViewClient() {

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (!loadingFinished) {
                redirect = true;
            }
            loadingFinished = false;
            web.loadUrl(url);
            return super.shouldOverrideUrlLoading(view, url);
        }

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            super.onPageStarted(view, url, favicon);
            loadingFinished = false;
            progressBar.setVisibility(View.VISIBLE);
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            if (!redirect) {
                loadingFinished = true;
            }
            progressBar.setVisibility(View.INVISIBLE);
            if (!url.equals(defaultURL)) {
                String afterDecode = "";
                try {
                    afterDecode = URLDecoder.decode(url, "UTF-8");
                } catch (UnsupportedEncodingException e) {
                    e.printStackTrace();
                }
                originalURL = afterDecode;
                logBuilder.append("\nonPageFinished url " + originalURL);
                Toast.makeText(mContext, originalURL, Toast.LENGTH_SHORT).show();
                if (originalURL.contains("123") || originalURL.contains("172") || originalURL.contains("smartcity")) {
                    logBuilder.append("\nredirect final url :" + originalURL);
                    autheticated();
                }
            } else {
            }
        }
    });
4

0 回答 0