Android 如何为DownloadManager请求设置图标?
我正在尝试为我创建的DownloadManager请求设置一个图标,但我无法做到这一点。 我读过关于创建广播接收器的文章,但我想知道如果没有它,是否有可能做到这一点。 这是我的DownloadManager请求代码:Android 如何为DownloadManager请求设置图标?,android,Android,我正在尝试为我创建的DownloadManager请求设置一个图标,但我无法做到这一点。 我读过关于创建广播接收器的文章,但我想知道如果没有它,是否有可能做到这一点。 这是我的DownloadManager请求代码: final String filename = getIntent().getExtras().getString("id") + ".apk"; DownloadManager.Request request = new DownloadManager.
final String filename = getIntent().getExtras().getString("id") + ".apk";
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
request.setTitle(filename);
request.setDescription("Downloading...");
request.setMimeType("application/vnd.android.package-archive");
// in order for this if to run, you must use the android 3.2 to compile your app
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
}
request.setDestinationInExternalPublicDir("/Library", filename);
// get download service and enqueue file
DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
manager.enqueue(request);
Toast.makeText(LinkActivity.this, "Download has started.", Toast.LENGTH_LONG).show();
下面是它现在的样子的一个示例:
我的目标是更改左侧通知ImageView的图像
非常感谢。您不能覆盖此图标。而且,如果我没记错的话,能够这样做没有多大意义,因为下载管理器可以运行多个下载,并且仍然需要一个通知槽来指示…您找到解决方案了吗?或者Marcin Orlowski在下面的回答中是正确的