LocalStorage not working in Android application

3,783 views
Skip to first unread message

Asif Ytzhak

unread,
Apr 17, 2013, 5:05:15 PM4/17/13
to phon...@googlegroups.com
I have a very strange problem with HTML5 LocalStorage in my Phonegap Android application. Maybe you will be able to help me.

I'm trying to use LocalStorage in my application but for some reason Android doesn't remember the LocalStorage values after I close the application (close it completely, not leave the app in the background).
In order to debug where the problem is, I started a new blank Android Phonegap 2.6.0 project (using the "create" command), and I use this JS code inside the "deviceready" event (this is the only change I did in the project):

alert("test:" + localStorage.getItem("test"));
localStorage.setItem("test","val");

But always when I close the application and open it again, I get a wrong "test:null" alert instead of "test:val", as it should be (should be saved in the LocalStorage).
Do you know what can be the problem? Why is the LocalStorage not working for me even on the example project of Phonegap 2.6.0?
BTW, I run the project on the emulator in Eclipse.

Thanks in advance,
Asif.

Asif Ytzhak

unread,
Apr 18, 2013, 4:44:51 PM4/18/13
to phon...@googlegroups.com
Oh, so it's an issue with Phonegap 2.6.0. I started to use Android Phonegap only in version 2.6.0 so I didn't know it wasn't a problem before.
Good to know I'm not alone. This thing drove me crazy.
Thanks guys.

Philip Murphy

unread,
May 2, 2013, 1:58:06 PM5/2/13
to phon...@googlegroups.com
Turned out issue was due to conflict between local storage and Google AdMob library - see Jira issue for further information: https://issues.apache.org/jira/browse/CB-3063
Reply all
Reply to author
Forward
0 new messages