我正在使用 downloadmanager 库进行下载过程,一切正常,但是当我在其他具有各种版本的 Android 的设备上运行它时,但是当我尝试在华为设备上运行它时,下载不想运行,我是困惑并搜索过谷歌但没有得到正确的搜索结果。这些是我的下载管理器代码。
DownloadManager.Request request=new DownloadManager.Request(Uri.parse(urlDownload));
DownloadManager manager= (DownloadManager)getSystemService(Context.DOWNLOAD_SERVICE);
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI|DownloadManager.Request.NETWORK_MOBILE);
request.setAllowedOverMetered(true);
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.allowScanningByMediaScanner();
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS,"app-release.apk");
DownloadManagerId=manager.enqueue(request);