Lisa Anne
Lisa Anne

Reputation: 4595

Android: how do I force file download (form Chrome, Gmail...) to a specific location defined by my app

When the user downloads an attachment/file from Chrome from Gmail, whatever I need the file to be downloaded to a specific defined directory.

I try to be more clear: I need to create an app that contains the files that are downloaded. Therefore the app will define a directory.

When the user downloads something from internet, Gmail.. the download should go in there.

I do not know how to implement this kind of behavior.

Upvotes: 0

Views: 1390

Answers (1)

dudebrobro
dudebrobro

Reputation: 1317

If you don't want the DownloadManager to put your file outside of your app or on external storage. You may have to handle the download requests yourself and just write the file out into a download directory within your apps data directory. This question has an example of how to get the OutpustStream of the connection and write out the file. Hope this helps.
Android:How to download the File from the server and save it in specific folder in sdcard.

Upvotes: 1

Related Questions