|
抄到的一段源码,里面的JS是Rexsee扩展的,发现可以直接生成apk,大家可以试试
1.把这个文件保存成index.html,上传到rexsee网站项目中心里。生成apk文件。
2.或者在你本地弄个web环境,然后把这个页面的url,通过rexsee官方站在线编译。生成apk文件。
这两种方式都可以..把apk想办法下载到android手机里.自己可以体验下.
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style>
a{color:#555;font-size:14px;}
</style>
<script type="text/javascript">
function get_gps(){
j=1;
if(rexseeGps.isReady()){
var rtn=rexseeGps.getLastKnownLocation();
rexseeGps.stop();
rexseeDialog.toast('停止定位。');
if(rtn==''){
alert('无法获取定位信息,现在获取基站信息!');
if (!rexseeCellLocation.isEnabled()){
rexseeCellLocation.enable();
}
var i=0;
while (i==0){
var jzinfo=rexseeCellLocation.getLastKnownLocation();
if (jzinfo)
i=1;
}
if (jzinfo==''){
alert("无法获取基站信息!");
}else{
rexseeCellLocation.disable();
var m_jd=eval('('+jzinfo+')').cid;
var m_wd=eval('('+jzinfo+')').lac;
var location=eval('('+jzinfo+')');
var type=location.type.toLowerCase();
var mcc=parseInt(location.operator.substring(0,3));
var mnc=(type=="gsm")?parseInt(location.operator.substring(3)):location.systemId;
var cid=(type=="gsm")?location.cid:location.baseStationId;
var lac=(type=="gsm")?location.lac:location.networkId;
var postData = "{\"version\":\"1.1.0\",\"host\":\"maps.google.com\",\"access_token\":\"2:k7j3G6LaL6u_lafw:4iXOeOpTh1glSXe\",\"home_mobile_country_code\":"+mcc+",\"home_mobile_network_code\":"+mnc+",\"address_language\":\"zh_CN\",\"radio_type\":\""+type+"\",\"request_address\":ture,\"cell_towers\":[{\"cell_id\":"+cid+",\"location_area_code\":"+lac+",\"mobile_country_code\":"+mcc+",\"mobile_network_code\":"+mnc+",\"timing_advance\":5555}]}";
var get_jzinfo=rexseeAjax.syncSubmit("http://www.google.com/loc/json",postData,"UTF-8");
var m_jd2=eval('('+get_jzinfo+')').location.longitude;
var m_wd2=eval('('+get_jzinfo+')').location.latitude;
document.loginForm.m_jingdu.value=m_jd2;
document.loginForm.m_weidu.value=m_wd2;
}
}else{
var m_jd=eval('('+rtn+')').longitude;
var m_wd=eval('('+rtn+')').latitude;
document.loginForm.m_jingdu.value=m_jd;
document.loginForm.m_weidu.value=m_wd;
}
}
}
function gps(){
rexseeGps.start();
rexseeDialog.toast('开始定位......');
var rtn=rexseeGps.getLastKnownLocation();
if ( rtn=='' ) alert('No LastknownLocation.');
else alert(rtn);
}
function onGpsStatusChanged(status){
alert("GpsStatusChanged. \nNew Status: "+status);
}
function onGpsLocationChanged(time,accuracy,longitude,latitude,speed,bearing,altitude){
rexseeProgressDialog.hide();
var str = "";
str += "
时间:"+time;
str += "
精度:"+accuracy;
str += "
经度:"+longitude;
str += "
纬度:"+latitude;
str += "
速度:"+speed;
str += "
方向:"+bearing;
str += "
海拔:"+altitude;
rexseeDialog.alert("位置信息",str);
}
</script>
<body>
<a href="javascript:gps();">基于GPS获取坐标</a>
<a href="javascript:get_gps();">基于GPS+基站获取坐标</a>
<a href="tel:13800138000">打电话</a>
<a href="smsto:13800138000">发短信</a>
<a href="javascript:rexseeApplication.exit()">退出</a>
<a href="javascript:rexseeApplication.confirmExit()">确认退出</a>
<a href="javascript:rexseeApplication.askForExit('测试','必须退出了!')">强制退出</a>
<a href="javascript:rexseeApplication.restart();">重启</a>
<a href="javascript:rexseeApplication.confirmRestart()">重启确认</a>
<a href="javascript:rexseeApplication.confirmUninstall()">卸载确认</a>
<a href="javascript:alert(rexseeApplication.getHome())">获取首页URL</a>
<a href="javascript:alert(rexseeApplication.getCurrentHome())">获取当前页URL</a>
<a href="javascript:alert(rexseeApplication.getDomailWhiteList())">获取url白名单</a>
<a href="javascript:alert(rexseeApplication.getAuthorName())">程序作者</a>
<a href="javascript:alert(rexseeApplication.getAuthorEmail())">程序作者邮箱</a>
<a href="javascript:alert(rexseeApplication.getLabel())">此软件包名称</a>
<a href="javascript:alert(rexseeApplication.getInstalledTime())">软件安装时间</a>
<a href="javascript:alert(rexseeApplication.getRunTimes())">软件运行次数</a>
<a href="javascript:alert(rexseeApplication.getVersionCode())">获取核心版本号</a>
<a href="javascript:alert(rexseeApplication.getTimeout()+'秒')">读取超时时间</a>
<a href="javascript:rexseeApplication.setTimeout(20);rexseeDialog.toast('设置完毕');">设置超时时间为20秒</a>
<a href="javascript:alert(rexseeApplication.getAutoClearCache());">是否自动清缓存</a>
<a href="javascript:alert(rexseeApplication.sendShortcutToDesktop());">把本程序加在桌面</a>
<a href="javascript:alert(rexseeGps.isReady());">看是否开启GPS</a>
<a href="javascript:onGpsStatusChanged();">状态</a>
</body>
</html> |
|