简体   繁体   English

你在哪里把下载的文件放在android中

[英]Where do you put downloaded filed in android

My application downloads files from the server and save them somewhere. 我的应用程序从服务器下载文件并将其保存在某处。 Where should I put the folder to save the files? 我应该把文件夹放在哪里保存文件? Not in assets right? 不是资产吗? Should I create a folder somewhere parallel to "bin" / "libs" / "res" folder? 我应该创建一个与"bin" / "libs" / "res"文件夹并行的文件夹吗?

Another question: should I put the downloaded files in internal storage or external storage? 另一个问题:我应该将下载的文件放在内部存储器还是外部存储器中?

Actually you can not save the downloaded file in either of this folders because they are not allowed to make modification at run time. 实际上,您无法将下载的文件保存在任何一个文件夹中,因为它们不允许在运行时进行修改。

Best option goes according to your requirement, as if you file is too large and you are not much worried about it's security then you can store them on SDCARD(External storage). 最佳选择根据您的要求而定,就好像您的文件太大并且您不太担心它的安全性,那么您可以将它们存储在SDCARD(外部存储)上。 and if your file is small enough and much secure then you should save them on internal storage. 如果您的文件足够小且安全性很高,那么您应该将它们保存在内部存储中。

Check most popular application store their files on SDCARD but encrypted way... 检查最流行的应用程序存储他们的文件在SDCARD但加密方式...

Hope this ans your question 希望这是你的问题

Store your downloaded files in a folder on an external storage directory. 将下载的文件存储在外部存储目录的文件夹中。 like 喜欢
String yourFolderPath = Environment.getExternalStorageDirectory() + /com.yourapp/;
Store files in that folder. 将文件存储在该文件夹中。

if its just few files, it would be safer and more convenient to use the context.getCacheDir(). 如果只有少量文件,使用context.getCacheDir()会更安全,更方便。 with it, you can be sure that it will always be there unlike sdcard which can be locked when the phone is in storage mode. 有了它,你可以确定它总是在那里,不像SD卡,当手机处于存储模式时可以锁定它。 it doesnt require manifest permission. 它不需要明确的许可。 You don't even have to worry about security unless your user is rooted. 除非您的用户是root用户,否则您甚至不必担心安全性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM