Download file with extension pdf and ms10 inside android webView

Home / Uncategorized / Download file with extension pdf and ms10 inside android webView

I’m trying to download pdf and ms10 extension file inside webView with the below code but it only shows "Downloading" and nothing happens. Should am I missing to add any extra intent in manifest file or any other thing I’m doing wrong?
webView.setDownloadListener(new DownloadListener() {

public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimetype,
long contentLength) {
DownloadManager.Request request = new DownloadManager.Request(

request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); //Notify client once download is completed!
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "Name of your downloadble file goes here, example: Mathematics II ");
DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
Toast.makeText(getApplicationContext(), "Downloading File", //To notify the Client that the file is being downloaded


Here is my android manifest.xml file:

Any help would be much much appreciated.

Useful library you can try it. Andvanced-Webview

and implements it’s onDownLoadRequested method

public void onDownloadRequested(String url, String suggestedFilename, String mimeType, long contentLength, String contentDisposition, String userAgent) {
// some file is available for download
// either handle the download yourself or use the code below

if (AdvancedWebView.handleDownload(this, url, suggestedFilename)) {
// download successfully handled
else {
// download couldn’t be handled because user has disabled download manager app on the device
// TODO show some notice to the user
Read more

Leave a Reply

Your email address will not be published. Required fields are marked *