1

I have been writing a downloader which is working fine on links that has extensions in them. e.g.

http://speedtest.ftp.otenet.gr/files/test100Mb.db

but it doesn't work with this link:

https://dl.apkmos.com/?dl=423b122b186bac91faf269d8432d393c

How can I extract a downloadable link from the above mentioned URL?

Lino
  • 5,084
  • 3
  • 21
  • 39
Zubair Rehman
  • 2,335
  • 2
  • 20
  • 25
  • 1
    It is hard to imagine what you did so that it is not working. It is as simple as issuing a GET request to the URL and store the result. – Henry Jul 28 '18 at 06:56
  • actually i have been using https://github.com/tonyofrancis/Fetch to download files but it doesnt allow to download from indirect links. I am trying to find ways to get file path from indirect link. – Zubair Rehman Jul 28 '18 at 06:57
  • you need the get the link form webview on button click,,,refer this https://medium.com/@kpbird/android-webview-detect-html-element-on-click-263431c52e01 – Gowthaman M Jul 28 '18 at 07:06
  • thanks for you reply, let me check :) – Zubair Rehman Jul 28 '18 at 07:09

1 Answers1

0

Try this

private class MyBrowser extends WebViewClient {
    @Override
    public boolean shouldOverrideUrlLoading(final WebView view, String url) {
        view.loadUrl(url);
        view.addJavascriptInterface(new Object()
        {
            @JavascriptInterface
            public void performClick() throws Exception
            {
                view.getUrl();  // here you can get apk download urls
                Log.d("LOGIN::", "Clicked");
              //  Toast.makeText(MainActivity.this, "Login clicked", Toast.LENGTH_LONG).show();
            }
        }, "login");
        return true;
    }
}

Webview's Html button click detection in Activity(java code)

Gowthaman M
  • 8,057
  • 8
  • 35
  • 54
  • thanks for you answer, i am getting url from web-view but how can i identify if user opens a link in firefox or chrome? – Zubair Rehman Jul 28 '18 at 07:17
  • @Zubair Rehman it's not a matter on which browser user opening....if you can able to get the link so you can able to donwload file using asyntask or downloadmanager – Gowthaman M Jul 28 '18 at 07:20
  • right, how can i plug this code with firefox or chrome browsers in android phone? could you please elaborate? – Zubair Rehman Jul 28 '18 at 07:23