Skip to content

Instantly share code, notes, and snippets.

@beilly beilly/AndroidPath.MD
Last active Aug 21, 2019

Embed
What would you like to do?
记录Android系统文件访问权限
Log.i(TAG,context.getCacheDir().getPath());
///data/user/0/{packageName}/cache
Log.i(TAG,context.getFilesDir().getPath());
///data/user/0/{packageName}/files
Log.i(TAG,Environment.getExternalStorageDirectory().getPath());
///storage/emulated/0   需要权限
Log.i(TAG,context.getObbDir().getPath());
///storage/emulated/0/Android/obb/{packageName}  不需要权限,获取其他应用路径的需要权限
Log.i(TAG,context.getExternalCacheDir().getPath());
///storage/emulated/0/Android/data/{packageName}/cache   不需要权限,获取其他应用路径的需要权限
Log.i(TAG,context.getExternalFilesDir(null).getPath());
///storage/emulated/0/Android/data/{packageName}/files   不需要权限,获取其他应用路径的需要权限

总结:获取应用程序相关的缓存路径都不需要权限,获取其他路径需要授权。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.