0

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.

user229044
  • 232,980
  • 40
  • 330
  • 338
Lisa Anne
  • 4,482
  • 17
  • 83
  • 157
  • Doesn't the [DownloadManager](http://developer.android.com/reference/android/app/DownloadManager.html) already handle downloading and storing files and storing them on the filesystem? – dudebrobro Aug 22 '13 at 12:31
  • @QuentinSwain thanks, indeed. The point is that I need the file to be put in a SPECIFIC DIRECTORY of my app – Lisa Anne Aug 22 '13 at 12:33

1 Answers1

1

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.

Community
  • 1
  • 1
dudebrobro
  • 1,287
  • 10
  • 17
  • thank you, but this does not help me much, since I basically need to build some sort of downloader, that is called when some download link is clicked ad put the files in it own directory – Lisa Anne Aug 23 '13 at 10:41