I am using $localStorage in Ionic framework. The $localStorage will be defaulted to browser localStorage resources when it is run in a web browser. However, after it is compiled to an Android app and iOS app, where or in which folder can I find the saved localStorage?
-
That seems to be platform-dependent. What are you trying to do? Any real access should best be done through the proper local storage API. – Thilo Apr 06 '16 at 02:37
-
@Thilo what do you mean by it? $localStorage is proper local storage API via angular and ionic. But i am not sure where it would be store after it is being compiled to android and ios app – vincentsty Apr 06 '16 at 03:05
-
I'm just wondering why you need to know where it ends up on disk when you can use the localStorage API to look at the data? Of course, if what @gargoyle says is true, that would be a concern. – Thilo Apr 06 '16 at 03:14
-
Related: http://stackoverflow.com/questions/27756628/how-can-i-browse-localstorage-on-the-device?rq=1 – Thilo Apr 06 '16 at 03:15
-
@Thilo I am well aware that i can get it through web debugging. But i need to know where can i browse the saved localstorage via the android/ios physical device itself. – vincentsty Apr 06 '16 at 03:18
2 Answers
Looked up some links on this:
Stackoverflow question: What database does PhoneGap use and what is the size limit?
Article: Ionic 2, Local storage and SQLite
Ionic forum thread: iOS local storage persistence
Intel software forum: LocalStorage Values lost once app is killed
Summarizing: The default localStorage implementation is handy, but not 100% reliable and there are alternatives if you need something more robust. How localStorage is persisted depends on how Cordova is implemented and differs per platform e.g. on iOS a WebView is used.
LocalStorage is not actually that stable in ionic. I think it stores the data somewhere in memory.
LocalStorage should not be used as a substitute for databases.
It has a 5 mb limit in ios and android.
And many have reported that when the device runs low on battery localStorage is cleared in ios. In android localStorage is cleared when you kill it from the task manager.So pr0bably stores in android app cache.
Its totally unstable to store any type of data in it.
You should use something like SQLite instead.

- 1
- 1