Question

Iam loading a url into a WebView. It loads a login page. After login the user gets redirected to different urls. When he reaches the last url he gets authenticated. I want to load another activity when the last url matches a String that I am forming.

Any help on how this can be achieved?

Was it helpful?

Solution

You seem to have asked this question 2-3 times now my friend.

I am not sure if i have a proper answer to your issue.

If i was in your place i would try to use some tools to fetch all the url's occurring due to the redirection. Try using tools like

http://redirectdetective.com/

http://www.internetofficer.com/seo-tool/redirect-check/

and in your onPageFinished get the current url of the webview using

String webUrl = webView.getUrl();

and compare it with the final url after redirection and then launch your intent

OTHER TIPS

If you want to check the urls try below code:

webView.setWebViewClient(new WebViewClient(){
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        if(url.contains("yourURL.com")){
            //Intent intent = new Intent(this, Test.class);
           //startActivity(intent);
                  webView.stopLoading(); //this line is to stop loading the webview
        }
        return true;
    }
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top