Can Download Manager save file in Internal storage in android?

Viewed 5315

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?

2 Answers

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

Related