Any help would be greatly appreciated
# android
o
Any help would be greatly appreciated
🧵 2
c
@Omotayo this channel is for kotlin specific questions related to android, so people will likely keep marking your questions as 😶 . You'll have better luck trying other communities like the /r/androiddev subreddit/discord, or stackoverflow.
a
You can use DownloadManager API to save file in user's downloads folder, in you onComplete(file: File?) callback just do:
Copy code
override 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.
Copy code
<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-android
o
Thank you so much @anotherstark… I’m so so grateful.
👍 1