そのようにDownloadManagerを使用しようとしています
DownloadManager.Request request = new DownloadManager.Request(uri)
.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_MOBILE)
.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI)
.setAllowedOverRoaming(true)
.setDestinationInExternalFilesDir(this, null,String.valueOf(mPathAndFolder))
.setVisibleInDownloadsUi(false)
.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN);
long downloadID = downloadManager.enqueue(request);
Android マニフェストに次の権限を追加しました
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION"/>
実行時に次のエラーが発生する
java.lang.NoSuchMethodError: android.app.DownloadManager$Request.setNotificationVisibility
なぜこのエラーですか?DownloadManager を機能させるには?