1

I've a webview setup in Android. The thing is that I want to download a file whenever user taps a particular element (like a video). I can attach event listeners using javascript into webview. But what do I do after that? How do I download file?

I tried to open the download URL (which starts the download on regular browser). But with WebView I get Webpage not available.

So it should happen like this:

Android --> JS executed on webview --> JS waits for user to tap a particular element --> JS somehow tells android to start download of a URL.

I'm not able to do the last step.

mehulmpt
  • 15,861
  • 12
  • 48
  • 88

1 Answers1

0

I have simply made an <a href="path_to_your_resource">link text</a> element and it's working fine. you could probably use the webview client and implement shouldOverrideUrlLoading. check this example How to download files from webview Android?

Community
  • 1
  • 1
bboydflo
  • 907
  • 1
  • 15
  • 24