I am using DownloadManager to download a xml file from a URL. It works fine but I have two questions:
1.) How can I show a message about the download in the closed notification bar? I can show a message when I open the bar like shown in this snapshot:
2.) How can I programmatically remove tis notification?
My code for the DownloadManager:
//Download XML file from URL
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(URL));
request.setTitle("Download von "+Name+".xml");
request.setDescription("Download von "+Name+".xml");
// 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(FileSeperator+"XML"+FileSeperator, Name + FileExtension);
// get download service and enqueue file
DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
manager.enqueue(request);