Intent filter to download attachment from gmail apps on Android

I was able to make the download and preview buttons pop up on Android in GMail by removing the scheme data filter in my intent (delete the scheme line and give it a try): <intent-filter> <action android:name=”android.intent.action.VIEW” /> <category android:name=”android.intent.category.DEFAULT” /> <category android:name=”android.intent.category.BROWSABLE” /> <data android:scheme=”file” /> <data android:mimeType=”*/*” /> <data android:pathPattern=”.*\\.ext” /> <data android:host=”*” … Read more

Force download of ‘data:text/plain’ URL

As of now, it has been made possible to use <a download> in Chrome. Using dispatchEvent, you can download any string as file (even with a custom filename) whenever you want. Here’s a utility function to use it: var downloadFile = function(filename, content) { var blob = new Blob([content]); var evt = document.createEvent(“HTMLEvents”); evt.initEvent(“click”); $(“<a>”, … Read more

How to download audio/video files from internet and store in iPhone app?

Creating a Folder For every app you have a Documents Folder. Any files you use in your app are stored here. If you want to create more directories here, then you’d do something like this: NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; // Get documents folder NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:@”MyNewFolder”]; … Read more

File opens instead of downloading in internet explorer in a href link

The download attribute is not supported in IE (see http://caniuse.com/#search=download%20attribute). That suggests the download attribute is only supported by firefox, chrome, opera and the latest version of blackberry’s browser. For other browsers you’ll need to use more traditional methods to force download. That is server side code is necessary to set an appropriate Content-Type and … Read more

Android webview: download files like browsers do

Finally i decided to look for the DownloadHandler from the Android Stock Browser code. The only noticeable lack in my code was cookie (!!!). Here’s my final working version (DownloadManager method): wv.setDownloadListener(new DownloadListener() { @Override public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimeType, long contentLength) { DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); request.setMimeType(mimeType); //————————COOKIE!!———————— … Read more

Android download PDF from URL then open it with a PDF reader

Hi the problem is in FileDownloader class urlConnection.setRequestMethod(“GET”); urlConnection.setDoOutput(true); You need to remove the above two lines and everything will work fine. Please mark the question as answered if it is working as expected. Latest solution for the same problem is updated Android PDF Write / Read using Android 9 (API level 28) Attaching the … Read more