0

I am trying to download a zip file and store it in the application's isolated storage. I am using the wonderfully elegant DownloadManager solution explained in the top answer here. Notice that they set the destination to the user's downloads folder. This is not desired. I don't want the user to have easy access to the file. Just my application.

request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "name-of-the-file.ext");

On Windows Store apps there is the concept of private application storage called 'Application Data' which is a filesystem location that is hidden from the user but accessible by the application. What's the right place to save this zip file in android?

Community
  • 1
  • 1
Azure Terraformer
  • 1,648
  • 1
  • 14
  • 33
  • 2
    `DownloadManager` does the actual downloading from another process. It has no more rights to your app's [internal storage](https://commonsware.com/blog/2014/04/07/storage-situation-internal-storage.html) than does any other app. It's possible that `setDestinationUri()` works with a `content:` `Uri` pointing to a `ContentProvider` of yours that supports `openFile()`, but I haven't seen this done. `DownloadManager` is usually used for user-accessible files; if you want to download something privately, use an HTTP API (`HttpURLConnection`, OkHttp3, etc.). – CommonsWare Mar 10 '16 at 01:09
  • I was worried about that. Pretty new to android. I will look into OkHttp. – Azure Terraformer Mar 11 '16 at 02:01

0 Answers0