10-16-2012 01:46 AM
can you please tell me why local storage will not work on android 2.3 version using phonegap technology..
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>First Group</title> <link href="style/style.css" rel="stylesheet" type="text/css" /> <!--link href="style/scrollpanel.css" rel="stylesheet" type="text/css" /--> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <script type="text/javascript" src="cordova-1.9.0.js"></script> <script type="text/javascript" src="script/soapclient.js"></script> <script type="text/javascript" src="script/common.js"></script> <script type="text/javascript"> document.addEventListener("deviceready", onDeviceReady, false); //Cordova is loaded and it is now safe to make calls Cordova methods function onDeviceReady() { checkConnection(); // navigator.splashscreen.hide(); } function checkConnection() { var networkState = navigator.network.connection.type; var states = {}; states[Connection.UNKNOWN] = 'Unknown connection'; states[Connection.ETHERNET] = 'Ethernet connection'; states[Connection.WIFI] = 'WiFi connection'; states[Connection.CELL_2G] = 'Cell 2G connection'; states[Connection.CELL_3G] = 'Cell 3G connection'; states[Connection.CELL_4G] = 'Cell 4G connection'; states[Connection.NONE] = 'No network connection'; alert('Connection type: ' + states[networkState]); if(states[networkState]=="No network connection") { alert("No Connection Available "); navigator.app.exitApp(); } } var stationList = new Array; function GetStationCodes() { var r = JSON.parse(window.localStorage.getItem("stations") )||[]; alert("Time"+r); if(r.length > 0){ document.getElementById('loadingImg').style.visibi lity = "hidden"; } else { alert("Call Web service"); document.getElementById('loadingImg').style.visibi lity = "visible"; var pl = new SOAPClientParameters(); var parameter1 = ""; var parameter2 = ""; pl.add("parameter1", parameter1); pl.add("parameter2", parameter2); SOAPClient.invoke(WSDLURL, "stationSearch", pl, true, GetStationCodes_callBack); }// } function GetStationCodes_callBack(r) { alert("Web service Response"+r); document.getElementById('loadingImg').style.visibi lity = "hidden"; window.localStorage.setItem("stations", JSON.stringify(r)); } </script> </head> <body onload="GetStationCodes()"> <div id="wrapper"> <div class="dashboard_cont"> <div class="topbar"> <div class="home_icon"><a href="#"><img src="images/back-arw.png" alt="Home" title="Home" /></a></div> <h1 class="fr"><a href="#"><img src="images/icon1.png" alt="" /></a></h1> Dashboard <a href="#"><img src="images/dwn_arw.png" alt="" width="18" height="12" /></a> <div class="cl"></div> </div> <div> <img src="images/ajax-loader.gif" id="loadingImg" visible =true style="margin:auto; position: absolute; left:50%; top:50%;"/> <ul> <li><a href="newarrivals.html" class="arivals" ></a> </li> <li><a href="newdeparture.html" class="departure" ></a> </li> <li><a href="" class="journey" ></a> </li> <li><a href="" class="destination" ></a> </li> <li><a href="" class="count" ></a> </li> <li><a href="" class="dispatch" ></a> </li> <li><a href="" class="faultreport" ></a> </li> <li><a href="" class="addapp" ></a> </li> </ul> </div> <div class="cl"></div> </div> </div> </body> </html>
10-16-2012 05:31 AM
Sorry this is a blackberry forum.
Try looking at: http://caniuse.com/
Search for localstorage and you will see which browsers can handle what you need.
10-16-2012 08:43 AM
Ravi,
Please post your Android questions in a Google forum. We cannot help you in here with them https://www.google.ca/#hl=en&sugexp=les%3B&gs_nf=3
10-16-2012 12:00 PM
Thanks i got the solution
01-23-2013 06:22 AM
Hi Ravi,
May I know the Solution ?
I am also facing same issue... local storage works on Android and Playbook ported app but not on BB10
Thanks
Abhinav Tyagi