I have a server that creates an object blob on the browser and I want to download this within WebView in an Android app. I tried redirecting the request to the browser instance as well as using the download manager to do this, but neither of them seems to work (Even though if I open up the same page in Chrome, the download operation works there).
I tried the following code,it throws error:
Android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=blob:https%3A//111.111.111.111%3A8080/40b63131-63b1-4fa4-9451-c6297bbd111a"
Edit
Android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=blob:http://digitalinsensu.com/0f0d6127-a0f1-44c3-af85-72f648258d6d
Code:
mWebView.setDownloadListener(new DownloadListener() {
public void onDownloadStart(String url, String userAgent,String contentDisposition, String mimetype,long contentLength) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
});
and this throws java.lang.IllegalArgumentException: Can only download HTTP/HTTPS URIs error:
mWebView.setDownloadListener(new DownloadListener() {
public void onDownloadStart(String url, String userAgent,String contentDisposition, String mimetype,long contentLength) {
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "download");
DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
dm.enqueue(request);
}
});
How should I be downloading the blob? Any help would be appreciated.