我的下载管理器在状态栏中没有显示通知图标。当您打开所有通知时,通知是存在的,但状态栏中缺少图标,因此人们无法一眼看出下载已经开始。这在老设备上不是问题,只出现在运行Android 9 Pie的Android手机上。
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(youtubeDataModel.getUrl()));
request.setDescription("Downloading " + simpleFileType + "...");
request.setTitle(fileName);
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setDestinationUri(Uri.fromFile(new File(downloadLocation + "/" + fileName + "." + fileExtension)));
DownloadManager manager = (DownloadManager) activity.getSystemService(Context.DOWNLOAD_SERVICE);
manager.enqueue(request);
我本以为状态栏会显示一个小的下载图标,但在新设备上它并没有。