我想检查手机是否在线。
如果在线,则将数据保存到服务器。
如果不在线保存在本地存储中并且移动连接到互联网,则将该数据提交到服务器并清空本地存储。
到目前为止我做了什么
if(navigator.onLine)
{
//send data to server logic cause mobile device connected to internet
}
else {
// add data to local storage cause you are not online
$localStorage.sendData[$localStorage.sendData.length-1].data =localStorage.myData;
// but as user become connected to internet check that data is available
// in local storage, then send to server
}
致力于离子框架...