我想让用户通过点击按钮暂停下载,或点击下载通知,这是我的代码
downloadbutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(Allow.equals(true)){
Uri downloadUri = Uri.parse(DOWNLOAD_FILE);
DownloadManager.Request request = new DownloadManager.Request(downloadUri);
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI);
request.setAllowedOverRoaming(false);
//request.setNotificationVisibility(Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
id = downloadManager.enqueue(request);
//Save the request id
SharedPreferences.Editor PrefEdit = preferenceManager.edit();
PrefEdit.putLong(strPref_Download_ID, id);
PrefEdit.commit();
}
});