smanikandan14 / ThinDownloadManager

To download files and to avoid using DOWNLOAD_WITHOUT_NOTIFICATION permission if you are using Android's DownloadManager in your apps.
Apache License 2.0
783 stars 186 forks source link

onDownloadComplete in DownloadStatusListenerV1 is not called #52

Closed pawegio closed 8 years ago

pawegio commented 8 years ago

After updating to 1.2.1 and replacing deprecated listener with new one, onDownloadComplete() is not called anymore, my code (kotlin syntax):

private fun downloadApk(context: Context, updateUrl: String, fileName: String, onProgress: (Int) -> Unit, onComplete: (Boolean) -> Unit) {
    val downloadUri = Uri.parse(updateUrl)
    val destinationUri = Uri.parse("${downloadDir.path}/$fileName")
    val downloadRequest = DownloadRequest(downloadUri)
            .setDestinationURI(destinationUri)
            .setDownloadContext(context)
            .setStatusListener(object : DownloadStatusListenerV1 {
                override fun onDownloadComplete(request: DownloadRequest?) {
                    onComplete(true)
                }
                override fun onDownloadFailed(request: DownloadRequest?, errorCode: Int, errorMessage: String?) {
                    onComplete(false)
                }
                override fun onProgress(request: DownloadRequest, totalBytes: Long, downloadedBytes: Long, progress: Int) {
                    onProgress(progress)
                }
            })
    ThinDownloadManager().add(downloadRequest)
}
ghost commented 8 years ago

same issue

smanikandan14 commented 8 years ago

Fixed in version 1.2.2. Please use compile 'com.mani:ThinDownloadManager:1.2.2'

ghost commented 8 years ago

smanikandan14, Thanks so much its work!

pawegio commented 8 years ago

now works fine, thanks!