i am very new to Android but i create a webview and it displays a wordpress page with a Download Link for a PDF in it, but when i tap on it nothing happends, i hope you can
Try to add this to to your code: (probably in your updateWebView
method) This will intercept any downloads and send them to the standard android download manager.
mWebView.setDownloadListener(new DownloadListener() {
public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimetype,
long contentLength) {
Request request = new Request( Uri.parse(url));
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "myPDFfile.pdf");
DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
dm.enqueue(request);
}
});
Note that this will use the same filename everytime, so your file may get replaced unless you modify the code to use a different filename.