Closed benazir0 closed 3 years ago
Are you experiencing this on both Android and iOS?
How are you storing the filelocation, with full path or only the filename, and gettting path from fileplugin?
Yes, on both Android and iOS. iOS situation is even worse: on every app build, all the downloaded files disappears. I created another issue for that.
With full path. If you look at the code snippet, I only resolve native path for Android, For iOS, I store the path returned by entry.ToURL().
Sorry for the long delay in replying, but I hadn't noticed, your reply.
File URI's in iOS will change, because of the layout of the filesystem in iOS
/var/mobile/Applications/<application UUID>/Documents/path/to/file (iOS)
the Application UUID is part of the path, but that UUID will change, because of app updates etc, so your "old" entry.ToURL() will be pointing at an old location, with no files.
Instead you should only be storing the filename, and get the path using the file pluging something like:
cordova.file.dataDirectory
that should give you the correct path, and you just append the filename.
If files magically disappear after some time, you probably chose a file location where the OS performs cleaning/cleanup operations. The issue is not within this plugin, as you need to handle the saving of the transferred file yourself. Take a look at https://github.com/apache/cordova-plugin-file#file-system-layouts to understand which places are suited and which might be cleaned by the OS itself.
Bug Report
Problem
Downloaded files disappear after few weeks
What is expected to happen?
Downloaded files stay on the persistent storage permanently on both Android and iOS platforms.
What does actually happen?
Downloaded files are not found after several days or weeks.
Information
I have downloaded PDF files from a website and then store the locations of the filenames on the local storage. Then I use FileOpener plugin to open PDF files. After few weeks, the file-opener does not find some of the downloaded files and throws file not found error. I'm assuming the phone OS is removing the files for not being used frequently. I'm experiencing this issue for nearly 6 months or so. Please see the code snippet I use to download a pdf file.
Command or Code
private downloadPDF(pdf: IPdf, callback: (data) => void) {
}
Environment, Platform, Device
I'm using Ionic Framework version 3. Platforms: Android and iOS
Version information
Ionic:
ionic (Ionic CLI) : 4.1.1 Ionic Framework : ionic-angular 3.6.0 @ionic/app-scripts : 3.1.8
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1) Cordova Platforms : android 6.4.0 Cordova Plugins : no whitelisted plugins (18 plugins total)
System:
Android SDK Tools : 26.1.1 (C:\Users[USERNAME]\AppData\Local\Android\sdk) NodeJS : v6.11.3 (C:\Program Files\nodejs\node.exe) npm : 6.5.0 OS : Windows 10
Checklist