Can a webapp have reliable local data storage on Android?
If not then can a web application be installed as a local application, to gain access to privileged APIs? Perhaps (this is just a wild guess) as a "Chrome extension" or an "Installed web app"?
Details
A single-page web application is a static web page on a web server without a backend-end database or API (i.e. there is no fetch
within the application).
The application stores and uses data on the user's device, and I want that storage to be reliable, i.e.
- I do not mind having to ask the user for permission
- But the data must not then be deleted without the user's consent
Now I'm worried that this article -- Managing HTML5 Offline Storage (from 2015) -- says,
Persistent storage is storage that stays in the browser unless the user expunges it. It is available only to apps that use the File System API, but will eventually be available to other offline APIs like IndexedDB and Application Cache.
... and the section Running out of storage suggests that storage may be deleted:
- If the user has more than 5 "offline" applications
- If the device begins to run out of disk space
The relevant APIs seems to be these:
Browsers | API |
---|---|
All | Window API: localStorage Web Storage - name/value pairs |
All | IndexedDB |
not Android! | Filesystem & FileWriter (a sandboxed file system) |
not Android! | File System Access (not in a sandbox) |
So can it be done on Android, or is there any workaround?
And the APIs mentioned in the article -- e.g. webkitPersistentStorage
-- are apparently deprecated. Have these been replaced by something, and are they available on Android?