优化
This commit is contained in:
@@ -83,6 +83,7 @@ class DownloadService : BaseService() {
|
|||||||
toastOnUi("已在下载列表")
|
toastOnUi("已在下载列表")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
kotlin.runCatching {
|
||||||
// 指定下载地址
|
// 指定下载地址
|
||||||
val request = DownloadManager.Request(Uri.parse(url))
|
val request = DownloadManager.Request(Uri.parse(url))
|
||||||
// 设置通知
|
// 设置通知
|
||||||
@@ -96,6 +97,12 @@ class DownloadService : BaseService() {
|
|||||||
if (upStateJob == null) {
|
if (upStateJob == null) {
|
||||||
checkDownloadState()
|
checkDownloadState()
|
||||||
}
|
}
|
||||||
|
}.onFailure {
|
||||||
|
when (it) {
|
||||||
|
is SecurityException -> toastOnUi("下载出错,没有存储权限")
|
||||||
|
else -> toastOnUi("下载出错,${it.localizedMessage}")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
|
|||||||
Reference in New Issue
Block a user