1. 添加插件:cordova plugin add cordova-plugin-file-transfer   

2. 调用方法:

var fileTransfer = new FileTransfer();
//下载地址;
var source="http://xxx/xxxx/ionic.apk";
var target="/sdcard/Download/ionic.apk";
var trustAllHosts = true;
var options = {};
function successCallback(entry){} ;
function errorCallback(error){}; fileTransfer.download(source,target,successCallback,errorCallback,trustAllHosts,options);
fileTransfer.onprogress = function(progressEvent){ if (progressEvent.lengthComputable){ $ionicLoading.show({ template: "已经下载:" +Math.floor((progressEvent.loaded / progressEvent.total)*100) + "%" }); }          }

 

相关文章:

  • 2021-10-22
  • 2021-06-17
  • 2021-10-29
  • 2021-09-21
  • 2021-11-30
  • 2022-12-23
  • 2021-09-22
猜你喜欢
  • 2021-05-24
  • 2022-02-22
  • 2021-12-29
  • 2021-05-16
  • 2021-08-30
  • 2022-01-15
相关资源
相似解决方案