Closed Wizardeirr closed 1 month ago
Could you share the code snippet?
For second problem, how are you observing? Also which version you are using?
ketch.download(url,path,fileName,tag, meta), ketchHelper.observeDownload(id) { downloadModel ->
LogService.v(
"DownloadLibrary",
"${downloadModel.id} - ${downloadModel.fileName} - ${downloadModel.status} - ${downloadModel.progress} - ${downloadModel.failureReason}"
)
}
2.0.1
For first part, if it is stucked in onqueued, it means WorkManager doesn't start the work, have you tried debug it? I need to check and reproduce when this can happen, please give me some time to get back. Additionally could you try some mechanism where if it does not start for sometime, you cancel the download and retry it?
For second part, as we are observing the flow, every time there is a call to observeDownloadById, it will give last state. To handle something only once when download is success, consider adding a flag and turn it off once success is called.
okay in addition files downloading but state already same. not change but files had been downloaded
In which scope you are calling observeDownload?, Could you check if due to some reason whether your scope is not cancelling?
Pls provide code snippet, it will help me reproduce?
CoroutineScope(Dispatchers.IO).launch { files.forEach { fileModel ->
url?.let {
var urlString = url + "/api/v1/appcat/download/${fileModel.FileUUID}"
if (fileModel.FileName != null && fileModel.FileUUID != null) {
var id = ketchHelper.download(
urlString,
fileModel.FileName,
path,
"policy",
fileModel.PackageName!!
)
if (id != 0){
ketchHelper.observeDownload(id) { downloadModel ->
LogService.v(
"DownloadLibrary",
"${downloadModel.id} - ${downloadModel.fileName} - ${downloadModel.status} - ${downloadModel.progress}"
)
if (downloadModel.status == Status.SUCCESS) {
LogService.v(
"DownloadLibrary",
"${downloadModel.id} - ${downloadModel.fileName} - ${downloadModel.status} - ${downloadModel.progress}"
)
} else if (downloadModel.status == Status.FAILED) {
LogService.v(
"DownloadLibrary",
"${downloadModel.id} - ${downloadModel.fileName} - ${downloadModel.status} - ${downloadModel.failureReason}"
)
}
}
}
}
}
}
}
@Wizardeirr I am not able to reproduce this, it is working fine on my device, pls check the complete code, seems like your scope is cancelling somehow. Please debug and let me know what is causing the issue, seems like it is not related to library.
Closing this for now. Will reopen if required
My APKs is downloading but state is stucked on QUEUED. ITS blocking all my other SYNTAX. Because i am trying install when APK download is SUCCESS. Second problem is Response. Thats entry 3 times SUCCESS. thats mean my codes catching 3 times to SUCCESS and all codes blow up