How to make a pdf file generated in Android appear as a download?

1

Well folks, I'm developing an application and I generate a PDF on Android at runtime. It turns out that the user does not receive any messages, or anything, to know where the file is. I would like to know if there is any way I can send this file to the Android download manager, is there a possibility? If not, what is the best way to show the user where the file is being written? (It's being written to the application's own folder)

    
asked by anonymous 27.06.2015 / 16:40

1 answer

0

I have decided as follows:

I created a download manager and added the file. By doing this it adds the downlaods folder and the list of downloads, and also shows a notification.

File arquivo = getFile(fileName); // Meu método para pegar o arquivo.
DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
dm.addCompletedDownload(fileName, "Portal do Aluno Ufac: "+fileName, true, "application/pdf", arquivo.getAbsolutePath(), arquivo.length(), true);
    
03.07.2015 / 03:06