#[non_exhaustive]pub enum AppDir {
Data,
Cache,
PublicMedia,
}Expand description
Directory for the app’s use.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Data
The directory for persistent-data files.
This will be deleted when the app is uninstalled and may also be deleted at the user’s request.
This may be accessible by other apps.
e.g.
/storage/emulated/{user-id}/Android/data/{app-package-name}/files/storage/{sd-card-id}/Android/data/{app-package-name}/files
Cache
The directory for cache files.
This will be deleted when the app is uninstalled and may also be deleted at the user’s request.
This may be accessible by other apps.
e.g.
/storage/emulated/{user-id}/Android/data/{app-package-name}/cache/storage/{sd-card-id}/Android/data/{app-package-name}/cache
https://developer.android.com/reference/android/content/Context#getExternalCacheDirs()
PublicMedia
For Android 11 (API level 30) or higher, this is deprecated. Use PublicDir of PublicStorage instead.
The directory for shared media files to other apps or user.
This will be deleted when the app is uninstalled and may also be deleted at the user’s request.
For Android 11 (API level 30) or higher,
this has been marked as deprecated.
It still works, but you should consider migrating to PublicStorage.
e.g.
/storage/emulated/{user-id}/Android/media/{app-package-name}/storage/{sd-card-id}/Android/media/{app-package-name}
https://developer.android.com/reference/android/content/Context#getExternalMediaDirs()