Tim,
1.
Here is what jumps out at me as suspicious. Of course, you may be
getting from point A to point B in a different way that is unfamiliar
to me. You may very well be using an A to B route that should work,
but exposes some obscure weakness in Phonegap. My list:
-the syntax I use is
.
.
var x="abc";
window,localStorage.setItem("savex",x);
.
.
var y= window,localStorage.getItem("savex");
.
.
You are missing the 'window.' See the API documentation.
- I assume that your onLoadCordova() function is called in the body
tag of index.html?
-I would like to see the setItem code to check if you are doing that
part correctly.
2. My general approach to these sorts of challenges is to blame
Phonegap, Eclipse, the phone, etc. So:
-uninstall the app from your phone. Re-install is not good enough.
localStorage survives a re-install and then any change in the keys in
localStorage leads to unpredictable results
-reboot the phone. Why not, can't hurt.
-reboot your desktop and start up eclipse. I assume that you are
using eclipse. I would suggest uninstalling and re-installing
eclipse, but that is too cruel.
-Now, sing God Save the Queen, then install a fresh copy of the app on
your device.
3.
If you sang the national anthem and it still does not work, I suggest
commenting out all the meat of your code and inserting a simple
localStorage example that pops up an alert and see if that works.
4.
So, if the simple example works, you can only blame some ahem
peculiarity in your code. Build it back up again in chunks by
uncommenting various sections one at a time if you can.
Good Luck
Herb
On May 23, 6:16 am, Akeman <
tim.but...@akemansolutions.com> wrote:
> > Hi All,
>
> Still battling this one.
>
> I am running with Cordova 1.7.0 and using an HTC One X Android 4.0.3 for
> testing.
>
> Using onDeviceReady, I read a variable that I set. I get three different
> values for this variable.
>
> 1. null
> 05-23 10:39:38.208: D/CordovaLog(31017):
> file:///android_asset/www/scripts/akCordova.js: Line 18 : onDeviceReady
> 05-23 10:39:38.208: D/CordovaLog(31017):
> file:///android_asset/www/scripts/akCordova.js: Line 24 : onDeviceReady
> localStorage.localStorage.getItem('rstp1') null
>
> 2. the actual value on the phone
> 05-23 10:38:17.604: D/CordovaLog(28929):
> file:///android_asset/www/scripts/akCordova.js: Line 18 : onDeviceReady
> 05-23 10:38:17.604: D/CordovaLog(28929):
> file:///android_asset/www/scripts/akCordova.js: Line 24 : onDeviceReady
> localStorage.localStorage.getItem('rstp1') |22/05
> start||1337710897765|1337712668121||||||1337712657471,l;1337712660474,l;133
7712667043,l;1337712668121,e;||22/05
> next||1337712677508|1337720568386||||||1337717881783,p;1337717885196,lp;133 7720211715,l;1337720478347,l;1337720568386,e;||22/05