我正在尝试为我创建的 DownloadManager 请求设置一个图标,但我无法做到这一点。我阅读了有关创建广播接收器的信息,但我想知道如果没有它是否可以做到这一点。这是我的 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的图像。
非常感谢。