How do I start default phone's download manager, like the one builtin in default browser? I need to create an intent that contains url of file to download. I know it's possible, as I saw some applications doing it in the past.
What you want is DownloadManager.
Browsing the Android source code reveals that the default browser is using this as well.
EDIT
You can browse the source code for DownloadManager here and try to use the code to make it work on 7. Bare in mind the dependencies of the class might also be not available on 7 (most probably) but it might be worth a look.
As easy as:
startActivity(new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS));
Related
I have an application which needs to ask the user for a file. I achieve it by starting an activity using an intent with Intent.ACTION_GET_CONTENT action and "file/*" MIME type.
It works fine on earlier android versions than 4.4. System shows the list of installed file managers, and my app gets a "file://" URL after I choose a file.
The problem comes when I run the app on KitKat. When the app wants to open a file on KitKat, the new built-in file picker shows up. It lists various sources to open a file, such as "Downloads", etc. But all files are greyed out. I can't open them. Ok, when I change MIME type to "*/*", it lets me open the same files. Then I open a file, and my application receives a "content://" style URL as result.
I know how to read data from those URLs, but it would be hard to rewrite the whole app to support it. It's a large one and was intended to work with files.
Is there any way to strictly define in the Intent that I want a "file://" url?
Or is there a way to prevent KitKat from using the new file picker framework? Is there any way to have it working in the same way as on earlier versions?
Can this problem be solved without implementing "content://"-style URL support in the app? Probably it would be the clearest solution...
Thanks in advance!
I have searched thoroughly but m unable to reach a solution on how to make pptx viewable in my app? Is there any library which i can add or any other solution because webview doesnt support this format?
I want to access my pptx file from my sdcard.
You can use Apache POI project
Apache POI Link
One way to do will be to fire an Intent with a specific Uri, and let the phone chose an application that can open that file, if any.
In my web site i make link likeDOWNLOAD. And when i open this site on my Android phone and click on link, standart browser opens txt file. I want to download file and not open.
What i may to do for that?
Thanks!
I think you need to set MIME type set on your server setting.
By default, the text.txt is linked with a viewer hence if will download and open.
Secondly, it would be stored in downloads folder on your sdcard.
The following link downloads a file from a site.it works fine in desktop browser. but it is not working in android default browser and in webview code(i used download listener too but not working).
I believe the Android default browser can't download .zip files by default (you should get a "This content is not supported" error).
If you want to download certain files through your own application though, you can try this this solution.
What code do you use? Could you specify it? I suggest you downloading it in AsyncTask via HTTP. Where do you save it? What is the error log? So many questions =)
Can I use android build-in browser download manager to download files in my application?
In case of audio files, opening remote file url using Intent.ACTION_VIEW with data type "audio/*" causes browser to start playback, but I'd like to force download of specified file.
The download manager is not part of the public SDK. You are welcome to download files from URLs via HttpURLConnection or HttpClient, both part of the Android SDK.
I am wondering exactly the same. It seems like a waste of time to write a service which handles download/resume/checking connection etc, when I just want to say downloadFile(URL myURL). Is there anything that could be re-used? Android Market also has a downloader...
http://developer.android.com/reference/android/app/DownloadManager.html
Can some one tell what is this? If download Manager isnt a part of SDK.
Seems to me like a complete download manager. I will try this soon.