Android 设备上的临时文件夹在哪里?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2364740/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 05:33:29  来源:igfitidea点击:

Where is the temp folder on Android devices?

androidtemp

提问by

Where is the temp folder located on Android phones?

Android 手机上的临时文件夹在哪里?

采纳答案by snctln

Reading this postfrom the android developers google group leads me to believe that there is not 1 global temp directory, and each application is expected to maintain their own temporary files.

阅读android 开发者谷歌组的这篇文章让我相信没有 1 个全局临时目录,每个应用程序都应该维护自己的临时文件。

回答by starfry

The temporary directory is /data/local/tmp.

临时目录是/data/local/tmp.

I've seen some comments that claim you need to be rooted to access it but I'm not sure that's true. Whilst it is true that you need root to freely access /data, this is not required for /data/local/tmp.

我看到一些评论声称您需要 root 才能访问它,但我不确定这是真的。虽然您确实需要 root 才能自由访问/data,但这不是/data/local/tmp.

I have verified this on Android 5.1.1.

我已经在 Android 5.1.1 上验证了这一点。

回答by Hein du Plessis

I believe what you're looking for is getCacheDir()!

我相信您正在寻找的是 getCacheDir()!