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