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.
Related
We are working on an android app that generates PDFs based on app contents on users' request. We are providing an option to launch an email agent and attach the generate PDF, but we also want the user be able to view the document later at any time. On android, there are no stock file explorer, so our first thought was to show on the stock Downloads app's file list. We've tried the following two methods but without luck.
We firstly tried to save the PDF to the default download folder (given by calling Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS)) and invoke media scanner, but the file doesn't show up in the Downloads app's list. It's shown in Adobe Acrobat's local document list though.
After some research, it seems that the Downloads app would only show files that downloaded though DownloadManager, so we tried to generate the PDF in a temporary directory and call DownloadManager to download it, but, somehow expected, it complains that we can only download via HTTP(S), so this approach isn't working as well.
Is there any other solution?
well if you have to provide access to the document without any file explorer app, i think your approach is correct it to allow to store it in the Download lists. To achive this you can use Nanohttpd in your application to host your pdf document and then invoke the DownloadManager download action using HTTP(S) to your webapp (you will have to create a small webapp to handle the download request) hosted on localhost server.
I am trying to download a file(it could be any file like image,pdf,text etc) using fileMetadata.getWebContentLink()
when i print this link it shows something like this:
https://drive.google.com/uc?id=0Bw6vr2LNxB3iUFJrTk5oZDljaTA&export=download
When i put this link into my desktop's browser the file is automatically downloaded. but i cant download this into my app.
I used this link to download using new DownloadFileAsync().execute(fileMetadata.getWebContentLink());
When i make the file public to access in my google drive then it works otherwise it doesn't work.
Can anyone know why is this happening and how to fix this??
WebcontentLink only works in browsers.
Here's the steps to download a file in your app as it is stated here
Retrieve the Drive File object and open the file contents. (Content is binary)
Read the content with Input Stream, save it and close it.
Is there a free way to view postscript files on android? I cannot find a solution online but surely lots of people must want to do this.
Recently Sam Buss and I realized that you can upload the PS file to Google Drive and once its uploaded to your drive, the drive viewer will open and render the PS file on your android device.
Here is a way that just worked for me on a Samsung Galaxy 5. Something similar can probably work for others. The general idea is to download the postscript file, and use an online web service to convert it to PDF, which you can then view.
Download the postscript file.
Open your browser (I use Chrome). Navigate to www.ps2pdf.com. Navigate your way to their "Convert" page, click the "Choose file" botton. Select "Documents" when it asks for "Choose an action". Go into your "Downloads" folder on your phone. Select the downloaded postscript file. Then, back on the ps2.pdf.com page, click the Convert button.
Click the active link for the converted PDF file. This opened in Adobe Reader, which is my default PDF viewer). If I want to access the file from other programs, it is in Adobe Reader's "Recent" folder in my phone's documents.
As posted in a previous question, that possibly is pointing me in the right direction,
I need to intercept the event of the user downloading a file (from the browser, form the email..) so that I can propmpt the user and save the file in a folder defined in my app.
And, viceversa I need to be able to intercept the event of the user uploading a file into a webpage, so that I can offer him to select the file from the folder defined in my app.
If somebody could point me in the right direction I would really be grateful!
If there is any open source solution already available that would be very useful as well.
I found this link: Intercepting links from the browser to open my Android app
You can intercept the link like explained in the answer. Once you've got the link, it is up to you how to handle it through code. If you want to download it with your own applications to a folder you desire, you can use following codes:
Download a File In Android From Remote Server
How to download file/image from url to your device
I hope these will help you.
What does it take to create a private Android application download server.
Or, at least, is there any documentation about the application loading process for Android?
Doesn't really take anything.
If you want you can put the APK (Android application) files in a public Dropbox if you like and distribute the urls. Similarly you could put the files on a web server. Just think of them as files in the same way you can download pdf files in your Android browser.
You need to have the "unknown sources" box ticked in Settings..Applications
Add file to server and create a download link for that file (plain html) . Add MIME TYPE of APK to your server . Now just browse the link ... And Enjoy !!!