I'm hitting a wall right now, I'd like to download a file with the DownloadManager
and it's working. However I'd like to custom that notification with for example instead of having the progress in percent on the right, I'd like to display: DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR / DownloadManager.COLUMN_TOTAL_SIZE_BYTES
and also add a button when the download is done (but for that I know there is a receiver when download completed)
So far my code looks like that:
DownloadManager downloadManager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(mpopup.apk));
NotificationCompat.Builder nBuilder = new NotificationCompat.Builder(this, "Channel_ID")
.setOngoing(true)
.setAutoCancel(false)
.setContentTitle("DOWNLOAD FILE")
.setContentText("Downloading 0MB/100MB")
.setProgress(100,0,false);
request.setTitle("DOWNLOAD TITLE");
request.setVisibleInDownloadsUi(false);
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN);
downloadManager.enqueue(request);
How do I do to update the progress bar and the text in my notification ? While it's downloading
I've tried : DownloadManager notification displays no percentage but it's not working and only display the log once completely downloaded