【问题标题】:DownloadManager not Showing Icon in Status BarDownloadManager 未在状态栏中显示图标
【发布时间】:2019-12-25 22:49:42
【问题描述】:

我的下载管理器未在状态栏中显示通知图标。当您打开所有通知时,通知是他们的,但状态栏中没有图标,因此人们无法一眼看出下载已经开始。这在旧设备上不是问题,并且仅在运行 android 9 pie 的安卓手机上。

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);

我希望状态栏显示一个小的下载图标,但在较新的设备上却没有

【问题讨论】:

    标签: java android android-download-manager


    【解决方案1】:

    尝试将请求通知可见性更改为

    request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-08
      • 1970-01-01
      • 2018-01-09
      相关资源
      最近更新 更多