Reputation: 33
I am developing an Hybrid Mobile app using Windows Phone 7 sdk and phonegap. Using Cordova local storage I am storing value. The stored value does not persist If I close the app and launch again in windows phone emulator. Anybody used local storage or alternative persistant storage in windows phone shares idea would be great.
window.localStorage.test = "Some test data";
console.log(window.localStorage.test) //It prints result but does not persist
Upvotes: 3
Views: 3023
Reputation: 84804
I believe the correct syntax is:
window.localStorage.setItem("test", "Some test data");
console.log(window.localStorage.getItem("test"));
Assigning properties appears to work simply because javascript allows you to attach new properties to objects.
Original Answer Are you closing the emulator between executions? The emulator clears its user state when you close it.
Upvotes: 4