package com.novoda.downloadmanager;

import android.app.Notification;
import android.content.Context;
import android.support.annotation.DrawableRes;
import android.support.v4.app.NotificationCompat;

class DownloadBatchNotification implements NotificationCreator {

    private static final int ID = 1;
    private static final boolean NOT_INDETERMINATE = false;

    private final Context context;
    private final int iconDrawable;

    DownloadBatchNotification(Context context, @DrawableRes int iconDrawable) {
        this.context = context.getApplicationContext();
        this.iconDrawable = iconDrawable;
    }

    @Override
    public NotificationInformation createNotification(DownloadBatchTitle downloadBatchTitle,
                                                      int percentageDownloaded,
                                                      int bytesFileSize,
                                                      int bytesDownloaded) {
        String title = downloadBatchTitle.asString();
        String content = percentageDownloaded + "% downloaded";

        Notification notification = new NotificationCompat.Builder(context)
                .setProgress(bytesFileSize, bytesDownloaded, NOT_INDETERMINATE)
                .setSmallIcon(iconDrawable)
                .setContentTitle(title)
                .setContentText(content)
                .build();
        return new DownloadBatchNotificationInformation(ID, notification);
    }

    private static class DownloadBatchNotificationInformation implements NotificationInformation {
        private final int id;
        private final Notification notification;

        DownloadBatchNotificationInformation(int id, Notification notification) {
            this.id = id;
            this.notification = notification;
        }

        @Override
        public int getId() {
            return id;
        }

        @Override
        public Notification getNotification() {
            return notification;
        }
    }
}

@@ -288,78 +288,106 @@
 nal 
-int ID = 1;%0A    private static final boolean NOT_INDETERMINATE = false
+boolean NOT_INDETERMINATE = false;%0A    private static final String CHANNEL_ID = %22download_manager%22
 ;%0A%0A 
@@ -1172,16 +1172,28 @@
 (context
+, CHANNEL_ID
 )%0A      
@@ -1413,24 +1413,25 @@
   .build();%0A
+%0A
         retu
@@ -1474,18 +1474,45 @@
 rmation(
-ID
+downloadBatchTitle.hashCode()
 , notifi

Introduce a more reliable id and channel for Notifications.