localStorage is not persistent upon restart/refresh / crosswalk


#1

Hi,

I use angular-local-storage. And it works but I noticed that the local storage values are reset to old values when I refresh. My use case is the following:

I run the app ionic run android
The user is a guest so I store the currentUser and the accessToken.
The user logs in so I update the currentUser and the accessToken.
I check the localStorage using Chrome Dev Tools
Everything is fine.

I restart the app ionic run android and the values for some, not all keys are different from the one I had before restarting the application.

Does anybody face the same issue?
Is it possible, it’s due to the fact I run the app with Crosswalk
Any alternative for localStorage?

Thanks


#2

Hi, in the blog post here http://ionicframework.com/blog/crosswalk-comes-to-ionic/ someone says that webview resources are not available if you are running the app with Crosswalk and that includes localStorage


#3

Actually it works great. It was an issue in my code.


#4

Could you please share what was the issue in your code?

I’m using localeStorage to save user session data and it is cleared every time I close the app… This issue is something that also occurs on some Android versions (I believe 5.0.1) on Cordova apps without the Crosswalk.

This is really frustrating, and to think that I thought Crosswalk will not have these stupid bugs…

localStorage.setItem(‘userId’, 17)
close the app
localStorage.getItem(‘userId’) returns null

Thanks,


#5

@icyKira, I have the exact same problem, did you ever found a solution?