Maryam
Maryam

Reputation: 913

Can Download Manager save file in Internal storage in android?

I read somewhere that Download Manager in android can not save the file in the internal storage because Download Manager does not run in my app process, but in another process controlled by the system. Internal storage locations are permissions protected and any location that you would provide would be accessible only to my application.

but when I used this code, it saved my file in Internal storage:

request.setDestinationInExternalFilesDir(ShowMovieActivity.this, Environment.DIRECTORY_DOWNLOADS,"Movie"+ID+".mp4");

I am confused, can anyone help me?

Upvotes: 7

Views: 7327

Answers (2)

hushed_voice
hushed_voice

Reputation: 3608

Internal storage means the internal storage of the Application not the internal storage of the Device. The internal storage of the app can only be accessed by the application itself. That is why download manager cant save the file directly to the internal Storage.

Android Documentation

There is a workaround for this. You can download the the file to an external storage like the way you did and then copy it to your internal directory of the application in the broadcast receiver.

Hope it helps

Upvotes: 5

Emmanuel BEBE
Emmanuel BEBE

Reputation: 63

DownloadManager as indicated by his name, is an external manager from android. You can't use Download Manager to save a file in internal storage because this directory is only for your application. You need a Content Provider to save your file in a temporary directory and then save it in your Internal storage.

Hope it's not too late :)

Upvotes: 2

Related Questions