浏览代码

Merge pull request #1906 from nextcloud/notificationManager

Get notification manager if it does not exist
Tobias Kaminsky 7 年之前
父节点
当前提交
026241a3af
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      src/main/java/com/owncloud/android/files/services/FileUploader.java

+ 5 - 1
src/main/java/com/owncloud/android/files/services/FileUploader.java

@@ -1158,7 +1158,11 @@ public class FileUploader extends Service
     private void notifyUploadResult(UploadFileOperation upload,
                                     RemoteOperationResult uploadResult) {
         Log_OC.d(TAG, "NotifyUploadResult with resultCode: " + uploadResult.getCode());
-        // / cancelled operation or success -> silent removal of progress notification
+        // cancelled operation or success -> silent removal of progress notification
+        if (mNotificationManager == null) {
+            mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+        }
+
         mNotificationManager.cancel(R.string.uploader_upload_in_progress_ticker);
 
         // Show the result: success or fail notification