1
DownloadManagerはアンドロイド8.0で動作しません、なぜ、誰かが私を助けることができますか? これは私が試みたものです。DownloadManagerはアンドロイド8.0で動作しません
val downloadBroadcastReceiver = DownloadBroadcastReceiver()
context.registerReceiver(downloadBroadcastReceiver, IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE))
request = DownloadManager.Request(Uri.parse(url))
val mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(folder + File.separator + fileName))
request.setMimeType(mimeType)
request.setDestinationInExternalFilesDir(context, Environment.DIRECTORY_DOWNLOADS, fileName)
request.setTitle(title)
request.setDescription(description)
request.setNotificationVisibility(VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
request.allowScanningByMediaScanner()
id = downloadManager.enqueue(request)
これを確認してくださいhttps://stackoverflow.com/a/48130822/1333975 – Ahmad
@Ahmadは適用されません。その質問では、OPの問題は彼が 'DownloadManager.Request.NETWORK_WIFI'を設定しているのに対し、ここではそうではありません。 –