diff --git a/src/main/java/com/owncloud/android/files/services/FileUploader.java b/src/main/java/com/owncloud/android/files/services/FileUploader.java index 6993c6ccc0c7..6bc94595df10 100644 --- a/src/main/java/com/owncloud/android/files/services/FileUploader.java +++ b/src/main/java/com/owncloud/android/files/services/FileUploader.java @@ -255,7 +255,7 @@ public void onCreate() { */ private void resurrection() { // remove stucked notification - mNotificationManager.cancel(R.string.uploader_upload_in_progress_ticker); + mNotificationManager.cancel(FOREGROUND_SERVICE_ID); } /** @@ -269,6 +269,9 @@ public void onDestroy() { mServiceHandler = null; mServiceLooper.quit(); mServiceLooper = null; + if (mNotificationManager != null) { + mNotificationManager.cancel(FOREGROUND_SERVICE_ID); + } mNotificationManager = null; // remove AccountsUpdatedListener @@ -705,7 +708,7 @@ private void notifyUploadStart(UploadFileOperation upload) { mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); } - mNotificationManager.notify(R.string.uploader_upload_in_progress_ticker, mNotificationBuilder.build()); + mNotificationManager.notify(FOREGROUND_SERVICE_ID, mNotificationBuilder.build()); } // else wait until the upload really start (onTransferProgress is called), so that if it's discarded // due to lack of Wifi, no notification is shown // TODO generalize for automated uploads @@ -730,7 +733,7 @@ public void onTransferProgress( if (mNotificationManager == null) { mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); } - mNotificationManager.notify(R.string.uploader_upload_in_progress_ticker, mNotificationBuilder.build()); + mNotificationManager.notify(FOREGROUND_SERVICE_ID, mNotificationBuilder.build()); } mLastPercent = percent; } @@ -748,8 +751,6 @@ private void notifyUploadResult(UploadFileOperation upload, RemoteOperationResul mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); } - mNotificationManager.cancel(R.string.uploader_upload_in_progress_ticker); - // Only notify if the upload fails if (!uploadResult.isCancelled() && !uploadResult.isSuccess() &&