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
Where is the temp folder on Android devices?
提问by
Where is the temp folder located on Android phones?
Android 手机上的临时文件夹在哪里?
采纳答案by snctln
回答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()!