Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

下载成功后仍回调多次 #6

Closed
flyfishxu opened this issue Apr 17, 2021 · 1 comment
Closed

下载成功后仍回调多次 #6

flyfishxu opened this issue Apr 17, 2021 · 1 comment

Comments

@flyfishxu
Copy link

// 创建任务 val downloadTask = lifecycleScope.download(downloadURL, "base.apk", this.filesDir.toString()) downloadTask.state() .onEach { state -> Log.i("Download APK", "Downloaded Progress: ${state.progress.percent()}") loadingDialog.progress = state.progress.percent().toInt() if (state is State.Succeed) { loadingDialog.dismiss() loadingDialog.progress = 0 Toast.makeText(this, "Download done!", Toast.LENGTH_LONG).show() installApk(this, ProgressDialog(this), "this.filesDir.toString()/base.apk") } } .launchIn(lifecycleScope) // 使用lifecycleScope downloadTask.start()
当本地已存在文件时下载会回调多次

@ssseasonnn
Copy link
Owner

谢谢反馈,我会尽快修复,你可以暂时先使用标记变量控制一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants