2
我试图为我创建的DownloadManager请求设置一个图标,但我无法设法做到这一点。 我读过有关创建BroadcastReceiver的信息,但我想知道如果没有它,可能会这样做。 这是我的下载管理器请求代码:如何为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在下面的答案中是正确的 –