<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
</head>
<body class="um-vp bc-bg" ontouchstart>
<div id="location"></div>
<div><b>历史位置</b></div>
<div id="ls"></div>
<div><b>历史地址</b></div>
<div id="ls2"></div>
<div><b>发送服务器记录</b></div>
<div id="web"></div>
<script src="js/appcan.js"></script>
<script src="js/appcan.control.js"></script>
</body>
<script>
var uid='';
var id=1;
appcan.ready(function() {
appcan.initBounce();
uexDevice.getInfo(10);
uexDevice.cbGetInfo=asd;
//报错提示
uexWidgetOne.cbError = function(opCode, errorCode, errorInfo){
alert("错误提示:errorCode:" + errorCode + "\nerrorInfo:" + errorInfo);
}
//打开定位功能
uexLocation.openLocation(0,5);
//指定 发生变化的 执行函数
uexLocation.onChange = locationCallback;
//获得地址后执行的函数
uexLocation.cbGetAddress = LocationSuccess;
})
function asd(opCode,dataType,data){
uid=data;
};
//启动定位功能,返回的通知函数 的回调函数
function locationCallback(lat, log){
uexLocation.getAddress(lat,log);
post(lat,log);
document.getElementById('location').innerHTML = "经度:" + log + " ,纬度:" + lat;
document.getElementById('ls').innerHTML =document.getElementById('ls').innerHTML+ "<br>"+id+"-经度:" + log + " ,纬度:" + lat;
id++;
}
//根据经纬度获取具体地址
function LocationSuccess(opCode, dataType, data){
document.getElementById('location').innerHTML = document.getElementById('location').innerHTML+data;
document.getElementById('ls2').innerHTML = document.getElementById('ls2').innerHTML+"<br>"+data;
}
function post(lat, log){
uexXmlHttpMgr.onData = redata;
uexXmlHttpMgr.open(100, 'get', 'http://ceshi.nongpingou.cn/1.php?a='+lat+'&b='+log+"&u="+uid, 300)
uexXmlHttpMgr.send(100, 1);
document.getElementById('web').innerHTML=document.getElementById('web').innerHTML+'<br>发送开始;'
}
function redata(opid,status,result){
document.getElementById('web').innerHTML=document.getElementById('web').innerHTML+result+'发送结束<br>';
uexXmlHttpMgr.close(100);
uexWindow.toast("0","5",result,"3000");
}
</script>
</html>