admin管理员组文章数量:1130349
刚开始用的OtaUpdate插件,插件内部使用downloadmanager实现的国内有很多机型不支持
思路:不想自己造轮子 使用网上现有插件
一、使用FlutterDownloader下载
二、open_file打开文件自带安装(FlutterDownloader自带打开文件,但不能打开app不知道为啥)
代码:
1、下载监听
FlutterDownloader.registerCallback((id, status, progress) {
print(
'Download task ($id) is in status ($status) and process ($progress)');
if (status == DownloadTaskStatusplete) {
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();刚开始用的OtaUpdate插件,插件内部使用downloadmanager实现的国内有很多机型不支持
思路:不想自己造轮子 使用网上现有插件
一、使用FlutterDownloader下载
二、open_file打开文件自带安装(FlutterDownloader自带打开文件,但不能打开app不知道为啥)
代码:
1、下载监听
FlutterDownloader.registerCallback((id, status, progress) {
print(
'Download task ($id) is in status ($status) and process ($progress)');
if (status == DownloadTaskStatusplete) {
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();版权声明:本文标题:flutter 更新app下载安装 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/jiaocheng/1754592001a2705422.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论