flutter已经支持安卓热更新_flutter Dynamic updates 热更新 版本更新

比较新的解释

https://juejin.im/entry/5c85c959f265da2d881b5eb8

flutter  Dynamic updates

flutter OtaUpdate  CodePush

https://blog.csdn.net/weixin_30512027/article/details/85772097

https://msd.misuland.com/pd/3127746505234976194

https://my.oschina.net/wupeilin/blog/3035732

唯一找到的 APP热更新资料

Code Push/Hot update

我们现在使用flutter更新版本

下载apk:

引入

dependencies:

flutter_downloader: 1.1.3

taskId = await FlutterDownloader.enqueue(

url: url,//服务端提供apk文件下载路径

savedDir: (await getExternalStorageDirectory()).path.toString(),//本地存放路径

fileName: “xiangta_” + netCode + “.apk”,//存放文件名

showNotification: false,//是否显示在通知栏

openFileFromNotification: false,//是否在通知栏可以点击打开此文件

);

//taskId为任务id (与完成下载的文件成一一对应)open是执行打开 打开需要任务id 相信你已经找到方向了

FlutterDownloader.registerCallback((taskId, status, progress) {

if (status == DownloadTaskStatus.complete) {

//下载完成

FlutterDownloader.open(taskId:taskId));

} else if (status == DownloadTaskStatus.failed) {

//下载出错

}

});

---------

一、使用FlutterDownloader下载

二、open_file打开文件自带安装(FlutterDownloader自带打开文件,但不能打开app不知道为啥)

代码:

1、下载监听

FlutterDownloader.registerCallback((id, status, progress) {

print(

'Download task ($id) is in status ($status) and process ($progress)');

if (status == DownloadTaskStatus.complete) {

OpenFile.open(_localPath);

FlutterDownloader.open(taskId: id);

}

});

2、下载

final taskId = await FlutterDownloader.enqueue(

url: url,

savedDir: _localPath,

showNotification:

true, // show download progress in status bar (for Android)

openFileFromNotification:

true, // click on notification to open downloaded file (for Android)

);

final tasks = await FlutterDownloader.loadTasks();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值