Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
177 views
in Technique[技术] by (71.8m points)

android - Download to internal memory possible?

I am using downloadmanager.request enqueue setDestinationUri to download files.

Is it possible to download the files to the internal memory location of the device where it can be persistent?

I am using Android 3.1 Xoom device and it does not really have a functional SD card on it though the app allows us to write to /mnt/ sdcard location.

Any way of storing downloaded file onto internal memory?

TIA

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It is unlikely that DownloadManager will be able to do this. My assumption is that DownloadManager does not run in your 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 your application.

It seems like you have two options.

(1) Supply a file path on "external" storage, when it completes, copy to internal storage, and then delete the file on external storage.

(2) Create a ContentProvider which DownloadManager can write to and give it a URI that corresponds to this ContentProvider. The ContentProvider that you implement can write the file to internal storage since it will run in the context of your application.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...