breautek commented on issue #510: URL: https://github.com/apache/cordova-plugin-file/issues/510#issuecomment-1025244967
`cordova.file.cacheDirectory` is the only directory of the directories you mentioned that the Android OS reserves the right to free files at any time. `cordova.file.externalDataDirectory` as of API 29 (although reversible with a flag) all external directories operate differently and applications don't have free access. As of API 30, the aforementioned flag is forcefully disabled, so you're forced to use the newer scoped storage system. Personally I'd avoid all `cordova.file.external*` directories. Natively, their paths start with `/storage/emulated/` or `/storage/sdcard` (depends whether the device is using a physical SD card). `cordova.file.applicationStorageDirectory` / `cordova.file.dataDirectory` shouldn't have their files removed unless it was an explicit action from the user (e.g. "Clear Data" button in App Info screen) or the app does it programmatically. Generally I use `cordova.file.dataDirectory` for files myself, but I don't work with image files. I don't think this works on release variants, but if you can reproduce on a debug variant of your app, I'd be curious if the files are shown under `adb shell`. Alternatively you can use Android Studio device file explorer as well. Refer to the [Device Path](https://github.com/apache/cordova-plugin-file#android-file-system-layout) for general file system locations. E.g. the below should show you your `cordova.file.dataDirectory` ``` adb shell run-as <your app bundle id> cd /data/data/<app.id>/files ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
