Persistent storage #497
Replies: 3 comments 1 reply
-
The user can clear ALL local storage. The browser's storage mechanisms (cookies, local storage, indexedDB) are all stored in the app's data directory. The file plugin exposes the ability to store files directory into the app's data directory, as well as some other directories. When the user uninstalls the app, or clears app storage, the OS will clear the app's data directories which includes all that is mentioned above. Short of controlling the data on a server and having the user to log into an account to relate that data to the user, it is impossible to guarantee persistent storage. Other options that doesn't involve a server:
Other apps may be able to read these files so it's not suitable if storing anything sensitive. The user can still delete the file, but as long as you don't use an app-specific external storage, the files should be retained (90% sure...). Apache's file plugin has limited support for external storage since Android's SAF framework. It's not suitable for writing documents to external storage. Therefore a third-party plugin that interfaces with the native MediaStore APIs is required.
Note that some jurisdictions, by law, you must provide some sort of mechanism to allow users to delete their data. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
You can create a text-file in the device's Documents folder with the fileWriter of the Cordova File Plugin (don't forget to delete an eventually existing file with the same name before - fileEntry.remove is your friend ...). From the Documents folder you (and everybody else) can read later this file with the fileReader of the Cordova File Plugin. Notes:
As an alternative the so far free Cordova Cloud Settings Plugin might serve. |
Beta Was this translation helpful? Give feedback.
-
On launch of our cordova app in android, it asks user to enter some url to get redirected, and we store it in localstorage. When we clear the appstorage the url gets cleared from localstorage. We want to store it in some persistent storage so that , even if we clear app storage we should be able to get url and use it later . I tried multiple ways with cordova file plugin , native storage, sqllite.. etc. , none of them seems to work. Facing issues with permissions in API>=30 .
Appreciate any ideas how to get this work done?
Beta Was this translation helpful? Give feedback.
All reactions