ssseasonnn / downloadx Goto Github PK
View Code? Open in Web Editor NEWDownload tool based on kotlin and coroutine.
License: Apache License 2.0
Download tool based on kotlin and coroutine.
License: Apache License 2.0
这是一个很好的库,但由于项目安全需要,我们希望该库可以自定义请求 Referer,当前是否可以自定义 Referer,若不可以,未来是否可以考虑加入这个功能
单任务或者多任务下载,偶尔会卡到某个进度不再下载,点击暂停再点击继续就可以重新下载。
此外还有一个疑问请教大佬?关于状态的监听那块,具体代码如下:
downloadTask.state()
.onEach { state ->
// 更新状态
setState(state)
// 更新进度
setProgress(state.progress)
}
.launchIn(lifecycleScope)
这个状态的监听,每次recyclerview上下滑动,都会触发监听(我在这里做了本地数据库参数的初始化,通过变量控制第一次加载从本地数据库获取数据),感觉应该是DownloadTask 发送一次即可,这个地方大佬有什么好的建议吗? 感谢!
依赖版本:implementation "com.github.ssseasonnn:DownloadX:1.0.2"
PS:1.0.1版本也试过,也是同样的问题
使用环境:小米8,雷电模拟器,移动网,电信网
使用代码:
val taskId = GlobalScope.download(
"https://rls.tapimg.com/pub2/202106/cdddafbfdaea6abdf0af1e524ca568ba.apk",
"taptap123.apk",
getExternalFilesDir("")?.path!! // 这里不设置保存路径,使用默认路径,也会出现同样的问题
)
taskId.state(1000)
.onEach {
Log.w("=====", "${it.javaClass.simpleName}---${it.progress.percentStr()}")
}.launchIn(lifecycleScope)
taskId.start()
请问支持若任务并发下载吗?
暂停下载后再开启下载 进度到百分之99就下载不动 返回failure 可能还剩几百个字节下载失败
下载过程中断开网络,程序崩溃。
能否支持Android 10 以上uri地址存储
如题,还有个问题在下载页Acitvity退出后如何监听下载状态和进度,监听state如果传入GlobalScope会报错
// 创建任务 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()
当本地已存在文件时下载会回调多次
调用downloadtask.stop后 再次调用start
下载进度又从0开始
1.后台下载支持通知栏通知
2.支持删除任务(改进)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.