Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 255
UpdateStrategy
Haoge edited this page Aug 6, 2018
·
2 revisions
设置更新的策略。可以根据需要灵活配置更新时的逻辑
[UpdateConfig.getConfig()/UpdateBuilder.create()]
.setUpdateStrategy(strategy);UpdateStrategy : 在WIFI环境下。不显示有更新的弹窗与下载进度条的弹窗通知。下载完成后显示弹窗通知
- 特性:
- 当为wifi环境时:静默下载。只显示InstallNotifier(下载完成后启动安装任务之前的)通知
- 当为非WIFI环境是:显示UpdateNotifier(有新版本更新)和DownloadNotifier(下载进度通知),下载完成后直接调起安装任务。
publicclassStrategyextendsUpdateStrategy {
@OverridepublicbooleanisShowUpdateDialog(Updateupdate) {
// 在检查到有更新时,是否显示弹窗通知。returnisShowUpdateDialog;
}
@OverridepublicbooleanisAutoInstall() { // 在下载完成后。是否自动进行安装returnisAutoInstall;
}
@OverridepublicbooleanisShowDownloadDialog() {
// 在下载过程中,是否显示下载进度通知return !isShowDownloadDialog;
}
}