Omotayo
08/14/2021, 8:39 PMColton Idle
08/15/2021, 1:17 AManotherstark
08/15/2021, 6:45 AMoverride fun onComplete(file: File?) {
file?.let {
val downloadManager = requireContext().getSystemService(DOWNLOAD_SERVICE) as DownloadManager
downloadManager.addCompletedDownload(it.name, it.name, true, "application/pdf", it.absolutePath, it.length, true)
}
}
Make sure you already have the following permission or else an exception will be thrown.
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Also, you might wanna check this out: https://stackoverflow.com/questions/28183893/how-to-store-files-generated-from-app-in-downloads-folder-of-androidOmotayo
08/15/2021, 2:17 PM