0
我有一个基于PhoneGap 2.0的移动应用程序,它使用LocalStorage。我的Android 2.3.3设备上的本地存储似乎像sessionStorage一样工作,即信息被保存并且只能在应用关闭之前使用。当我重新启动应用程序时,信息消失了。Android上的PhoneGap - localStorage不工作
我访问这样的/存储的信息:在部署到WP7手机(使用window.localStorage)
function onDeviceReady()
{
if(typeof(Storage)!=="undefined")
{
if(localStorage.getItem("test") != null)
{
alert(localStorage.getItem("test"));
}
...
localStorage.setItem("test", "test Value");
}
}
同样的解决办法正常工作。我尝试过和没有“窗口”。字首。在显示之前,我也尝试将localStorage中的值分配给全局变量,正如某些线程所建议的,没有运气。
我在2.3.3模拟器上试过这个,但它似乎并没有工作。我打开我的应用程序,确保localStorage得到更新,然后我转到Android菜单并手动停止应用程序。当我重新打开它时,locaStorage是空的 – filip