Skip to content

DownloadNotifier

Haoge edited this page Aug 6, 2018 · 2 revisions

作用

在APK下载时,显示下载进度条通知

配置

[UpdateConfig.getConfig() / UpdateBuilder.create()]
.setDownloadNotifier(notifier)

接口

DownloadNotifier

默认实现

DefaultDownloadNotifier

定制

publicclassCreatorextendsDownloadCreator {
@OverridepublicDownloadCallbackcreate(Updateupdate, Activityactivity) {
// 当更新策略中的UpdateStrategy.isShowDownloadDialog为true时。在下载前会调用到此进行进度条通知容器创建。// update: 更新数据实体类// activity: 当前顶层的Activity实例。// 在此创建一个DownloadCallback实例。下载时的进度会通知到此实例回调中来。然后即可对界面进行更新做进度显示操作。// 当下载失败时。会通知到此处返回回调中的onDownloadError方法。若此时需要重启下载任务。调用restartDownload()即可
}
}

Clone this wiki locally