[android] FilePath 에 대한 이야기
-
API 를 통해 FilePath 를 가져올 때 absolute path 정보가 조금 아리까리하다.
그래서 FilePath return 을 정리하여 감을 잡기 쉽게 하기 위해 이 글을 적어본다.
-
아래 path 에 data/user/0 = data/data 이다. (main user 일 경우)
-
https://developer.android.com/reference/android/content/Context.html#getDir(java.lang.String,%20int)
Context.getDir(<directoryName>, MODE_PRIVATE)
/data/user/0/<packageName>/app_<directoryName>
-
https://developer.android.com/reference/android/content/Context.html#getFilesDir()
Context.getFilesDir()
/data/user/0/<packageName>/files
Context.getExternalFilesDir(<directoryName>)
/storage/emulated/0/Android/data/<packageName>/files/<directoryName>
-
Context.getFileStreamPath(“”)
/data/user/0/<packageName>/files
-
https://developer.android.com/reference/android/content/Context.html#getNoBackupFilesDir()
Context.getNoBackupFilesDir()
/data/user/0/<packageName>/no_backup
-
https://developer.android.com/reference/android/content/Context.html#getCacheDir()
Context.getCacheDir()
/data/user/0/<packageName>/cache
https://developer.android.com/reference/android/content/Context.html#getExternalCacheDir()
Context.getExternalCacheDir()
/storage/emulated/0/Android/data/<packageName>/cache
-
https://developer.android.com/reference/android/content/Context.html#getDataDir()
Context.getDataDir()
/data/user/0/<packageName>
-
https://developer.android.com/reference/android/content/Context.html#getObbDir()
( obb 는 opaque binary blob 으로 google 이 android file system 을 위해 개발한 포맷. )
Context.getObbDir()
/storage/emulated/0/Android/obb/<packageName>
-
https://developer.android.com/reference/android/content/Context.html#getCodeCacheDir()
Context.getCodeCacheDir()
/data/user/0/<packageName>/code_cache
-
https://developer.android.com/reference/android/content/Context.html#getExternalMediaDirs()
Context.getExternalMediaDirs()
/storage/emulated/0/Android/media/<packageName>
-
https://developer.android.com/reference/android/os/Environment
Environment.getDataDirectory()
/data
Environment.getDownloadCacheDirectory()
/data/cache
Environment.getExternalStorageDirectory()
/storage/emulated/0
Environment.getExternalStoragePublicDirectory(<directoryName>)
/storage/emulated/0/<directoryName>
Environment.getRootDirectory()
/system
끝