Kotlin Download Arquivo de URL

val downloadmanager = getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager?
        val uri: Uri = Uri.parse("http://www.example.com/myfile.mp3")

        val request = DownloadManager.Request(uri)
        request.setTitle("My File")
        request.setDescription("Downloading")
        request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
        request.setVisibleInDownloadsUi(false)
        request.setDestinationUri(Uri.parse("file://" + folderName.toString() + "/myfile.mp3"))

        downloadmanager!!.enqueue(request)
abdullah