您的位置:首页 > 移动开发

文件下载以及安装(installApp以及download)

2017-02-27 15:23 681 查看
<body>
<a class="fz-m4" href="http://118.112.188.108:8011/apps/cdsim.apk">ahahahahahahahahah</a>
<div class="fz-m3 a">点击这儿!</div>
</body>
<script type="text/javascript">
$(".a").on("tap",function(){
md.download({
url: "http://118.112.188.108:8011/apps/cdsim.apk",
savePath: "fs://test.apk",//(可选项)存储路径,不传时使用自动创建的路径
report: true,//(可选项)下载过程是否上报
cache: true,//(可选项)是否使用本地缓存
allowResume: true//(可选项)是否允许断点续传
},function( ret, err ){//ret类型:JSON对象,内部字段:state:0(下载状态(详见下载状态常量))等
if(ret){
if(ret.state){
md.installApp({//安装应用
appUri: 'fs://test.apk'
});
}
}else{
console.log( JSON.stringify ( err ) );
}
});

})

</script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐