I have used the Ionic framework to build my App and have been thinking about the local storage and how it works. One of my users phone storage is capped out with photos and video content, and I was wondering how this would effect an HTML5 App that uses local storage.
I decided to test it by purchasing a cheap phone with only 2GB internal storage, and filling it up with random Audio files from my PC. I have managed to get Windows to think there is 0kb left in internal storage, yet my Ionic App can still add data to local storage.
Does anyone know why this is, or have any input as to where local storage actually is saved? I sort of expected it to just store in the browsers App Data, but maybe it is somewhere else?
EDIT
Have just looked at the phone storage and it says there is still 99.9mb that is un-used. Android must not let Windows fill all of the device's storage. Does anyone still have any knowledge on what would happen if I managed to fill this last 99mb??
OK.. I cleared my App data and then managed to fill up the last 99mb of space by duplicating more files using the File Commander App on the phone.
I then opened my Ionic App and logged in (which downloads about 1.5mb of App data) and the App seemed to work fine (as everything was stored in RAM at the time). Once the App closed and I re-opened it, all the stored data was gone (as there was no space to move it to from RAM I am guessing)
End result: App works fine in RAM but if there is no space in localStorage, it will not error or tell you it didn't work, it will just not save the data.
Note: I have not tested this when there has been existing data in App, and trying to add to it which would take the phone over the storage limit. Im unsure if this would corrupt the existing data or just not let you add to it.
Related
When the user starts my PWA from the iOS start screen (installed PWA) it accesses one instance of storage (IndexedDB, cookies, etc). When he starts the same PWA through Safari it accesses a different storage instance. It is very inconvenient, because from the user perspective he opens the same app, but he doesn't see the same data.
How can I make sure each PWA's data storage is updated when the other makes a change?
To make things more complicated, I can't rely on having an internet connection, so I can't sync my data with a server. And I can't force the user to only start the PWA from the start screen. And I can't use the new File System Access API, because it will annoy the user with file access prompts.
Each time appp is opened, user recieves data in Ajax request, it is stored in browser localStorage, and when user next time opens app, it shows localStorage values from the very first time they were set. Seems like after initially setting localStorage items, they won't change. They work fine during app, but when opening it again, there still are the very first values.
App is built on iOS and Android using Cordova latest version (as of current), using jQuery Ajax requests and browser localStorage.
Example:
User opens app for first time.
Access token is requested and is saved in localStorage localStorage.setItem('token', '1234');
User uses app for some time and exits.
Next time user is opening app and gets token, it is again saved in localStorage localStorage.setItem('token', 'abcd');
User uses app, then quits.
Again opening app and checking localStorage, the stored access token is 1234 from the first time.
iOS considers any data stored inside the Webview of an app (HTML5 Local Storage, WebSQL, IndexedDB, Cookies, etc.) be temporary/cache data.
Therefore, if an iOS device starts to run low on space, iOS may decide to wipe the Webview data to recover space.
When this happens, the app name on the Home screen changes to "Cleaning..." and when you next launch your app, all your Webview data is gone.
For this reason, I moved from storing data inside the Webview of Cordova apps to storing it in a native SQLite database using the cordova-sqlite-storage plugin.
The native DB file is considered "proper" data by iOS so is not wiped when an iOS device runs low on storage space.
I empirically tested both scenarios by filling an iPad with movies until it was running low on space, triggering iOS to start its "cleaning" of installed apps.
For more info, see this related issue.
I have a Cordova app and I noticed that its size is increasing every time I navigate the section where there are many images (links from web and not stored on the device).
I think that the reason is that I need to clear webview cache (I use Crosswalk so the webview is based on chromium).
I search around but I can't find a way to clear only cache every time user exits the app.
I tried to run window.location.reload(true) on exit but it does not work.
Besides, I have found some plugins that do the job, but they remove all storage data (localstorage too) and I don't want that.
Could you help me with that?
Thanks
I'm trying to save settings in a Javascript Based Universal App in Windows 10.
I'm currently using localStorage and it seems to be working fine. But I've seen other posts that indicate I should use:
Windows.Storage.ApplicationData.current.localSettings
(see: Best way to store string array in local storage, Windows 8?)
And this works as well.
But I'm wondering what is the recommended way? localStorage seems to be persistent even when I quit and reload the app. But will it always be persistent? And will it work on mobile? or is localSettings generally the way to go, what's the difference here guys?
ApplicationData.current.localSettings is backed up in the cloud, which means that if the user buys a new phone (or resets their existing phone) and asks to restore settings from a backup of their old phone, the settings in ApplicationData.current.localSettings will be restored to the new phone. This article discusses app data backup in more detail.
I'm new to WP8.1 developing so this might be a newbie question:
I'm writing an app that have some settings, so i'm using these APIs:
var applicationData = Windows.Storage.ApplicationData.current;
var localSettings = applicationData.localSettings;
As i can see from emulator everything works well if i save a value and then get it out later, even if i close the application with task manager (holding the back button of the emulator): if I run the app again it has the correct values saved.
But if I shut down the emulator and re-launch the app from Visual Studio it starts with default values.
Is it because the emulator is freshly created every time and my app installed every single time or something is wrong with my ApplicationData usage?
I mean: if I use a true phone with these settings (don't have one now) will the customized settings saved even if i turn off the phone? Or I have to use some more "deep" API to permanently save an application setting?
Thank you for your help!
Gianluca
According to this link http://sviluppomobile.blogspot.com/2013/01/saving-windows-phone-8-emulator-state.html, yes, Windows Phone emulator does not save its state, so every time you start the emulator, you get a "new" fresh system as if you turned on a real phone for the first time.
On the other hand, when you use a real device then the state will be preserved and you will not loose your data when you restart the phone.
In 8.1 emulator you can go on Additional Tools -> chechpoints and save the current configuration of your emulator (set as default one if you want it next time you open the emulator)