@@ -31,6 +31,7 @@ public class UploadService extends IntentService {
31
31
32
32
private static final String SERVICE_NAME = UploadService .class .getName ();
33
33
34
+ private static final int UPLOAD_NOTIFICATION_ID = 1234 ; // Something unique
34
35
private static final int BUFFER_SIZE = 4096 ;
35
36
private static final String NEW_LINE = "\r \n " ;
36
37
private static final String TWO_HYPHENS = "--" ;
@@ -354,27 +355,27 @@ private void createNotification() {
354
355
.setContentText (notificationConfig .getMessage ())
355
356
.setSmallIcon (notificationConfig .getIconResourceID ())
356
357
.setProgress (100 , 0 , true );
357
- notificationManager .notify (0 , notification .build ());
358
+ notificationManager .notify (UPLOAD_NOTIFICATION_ID , notification .build ());
358
359
}
359
360
360
361
private void updateNotificationProgress (final int progress ) {
361
362
notification .setContentTitle (notificationConfig .getTitle ())
362
363
.setContentText (notificationConfig .getMessage ())
363
364
.setSmallIcon (notificationConfig .getIconResourceID ())
364
365
.setProgress (100 , progress , false );
365
- notificationManager .notify (0 , notification .build ());
366
+ notificationManager .notify (UPLOAD_NOTIFICATION_ID , notification .build ());
366
367
}
367
368
368
369
private void updateNotificationCompleted () {
369
370
if (notificationConfig .isAutoClearOnSuccess ()) {
370
- notificationManager .cancel (0 );
371
+ notificationManager .cancel (UPLOAD_NOTIFICATION_ID );
371
372
return ;
372
373
} else {
373
374
notification .setContentTitle (notificationConfig .getTitle ())
374
375
.setContentText (notificationConfig .getCompleted ())
375
376
.setSmallIcon (notificationConfig .getIconResourceID ())
376
377
.setProgress (0 , 0 , false );
377
- notificationManager .notify (0 , notification .build ());
378
+ notificationManager .notify (UPLOAD_NOTIFICATION_ID , notification .build ());
378
379
}
379
380
}
380
381
@@ -383,6 +384,6 @@ private void updateNotificationError() {
383
384
.setContentText (notificationConfig .getError ())
384
385
.setSmallIcon (notificationConfig .getIconResourceID ())
385
386
.setProgress (0 , 0 , false );
386
- notificationManager .notify (0 , notification .build ());
387
+ notificationManager .notify (UPLOAD_NOTIFICATION_ID , notification .build ());
387
388
}
388
389
}
0 commit comments