How to Get Captive portal redirect URL form webview with Wifi Connection?

494 views Asked by At

How to Get Captive portal redirect URL form webview with Wifi Connection.Webview Client on Page Finish is Not call.so i'm not getting any redirection page.any one have idea please help me.

        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 {
            }
        }
    });
0

There are 0 answers