用adnroid自带的DownloadManager.Request下载,在通知栏,点击下载进度,
怎么才能打开手机系统的下载管理呢?
下载的代码如下:
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE);
request.setTitle("云八管家");
request.setDescription("正在下载...");
request.setDestinationInExternalPublicDir("cloud8", apkName);
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_MOBILE | DownloadManager.Request.NETWORK_WIFI);
request.allowScanningByMediaScanner();
request.setVisibleInDownloadsUi(true);
request.setMimeType("application/vnd.android.package-archive");
DownloadManager downloadManager = (DownloadManager) mContext.getSystemService(Context.DOWNLOAD_SERVICE);
long enqueue = downloadManager.enqueue(request);
SPUtil.putLong(mContext, "download", enqueue);
上面是下载的代码执行后,在通知栏会有一个进度条,如果是移动网络会出现如图的情况,如果在wifi状态下就会开始下载,如下图:
然后我想,点击这个通知栏, 通过Intent打开系统的"下载管理".
怎么都找不到是怎么样的Intent,求大神解答下
下面是我下载监听的代码:
try {
if (intent.getAction().equals(DownloadManager.ACTION_DOWNLOAD_COMPLETE)) {
TbLog.i("--------------下载完毕");
long longExtra = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);
if (longExtra == SPUtil.getLong(context, "download", -11)) {
TbLog.i("--------------开始安装新版本");
Intent install = new Intent(Intent.ACTION_VIEW);
File file = queryDownloadedApk(context);
install.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
install.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(install);
}
}
else if(intent.getAction().equals(DownloadManager.ACTION_NOTIFICATION_CLICKED)) {
//问题来了这是点击通知栏事件,
//在这里,怎么通过代码打开下载管理呢??
Intent i = new Intent();
....?
}
} catch (Exception e) {
e.printStackTrace();
}
我想点击通知栏会打开如下图的界面:
我看有些app实现了这个功能,跪求解答.