Android open only certain links in Webview

Asked

Viewed 37 times

1

I have the following code:

    @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url)
        {
            if (url.contains("https://m.sendspace.com/") || (url.contains("https://www.mediafire.com/file/") )) { // Could be cleverer and use a regex

                return false;
            }
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
            startActivity(intent);
            mWebView.stopLoading();


            return false;
    }

The links listed there are opened in the application itself, already if the user requests a link that is not there, will open in the browser. This works ok! Now my problem is, Mediafire links have different identification numbers example: download1856.mediafire.com, download2536.mediafire.com... How do I make these links also open in the application itself?

  • Do you have one of those complete ai? What happens when you try to open this link in the browser?

  • Opens in standard browser. The link http://download1235.mediafire.com/t8nb1328qtcg/ehq80ly9q3gdcyz/Simple+Trolls.mcpack (Example)

  • But this link would be a file, however instead of opening a page, you need to create a schedule to download the file. Would that be it?:

  • Yes, it already has the download manager, but as it comes to several Mediafire links they have the first different numbering. In other words, ask to open in the browser :-(

  • If the content of the link varies but the structure remains constant use the structure to identify them.

  • How to do this?

  • Guys, I got it, but sometimes it opens in the browser, it disturbs a lot! What I do??

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.