private void handleDownloadFail(DownloadTask downloadTask) { long taskId = downloadTask.getId(); String filePath = downloadTask.getSaveFilePath(); if (filePath != null && filePath.length() > 0) { File saveFile = new File(filePath); if (saveFile.exists()) { saveFile.delete(); } } IDownloadService mDownloadController = GOLauncherApp.getApplication().getDownloadController(); try { if (mDownloadController != null) { mDownloadController.removeDownloadTaskById(taskId); } } catch (RemoteException e) { e.printStackTrace(); } sendBroadcastingToAppCenter(downloadTask); // 首先移除之前的通知 if (mNotificationManager != null) { // 移除之前的通知 // mNotificationManager.cancel(NOTIFY_TAG, (int) downloadTask.getId()); mNotificationManager.cancel(NOTIFY_TAG, (int) downloadTask.getId()); // 更新下载信息 if (mShowNotification && mNotification != null) { mNotification.tickerText = mFailTickerText; mNotification.contentIntent = mPendingIntent; mNotification.flags = Notification.FLAG_AUTO_CANCEL; // mNotificationManager.notify(NOTIFY_TAG, (int) downloadTask.getId(), mNotification); if (mNotification.contentView != null) { mNotificationManager.notify(NOTIFY_TAG, (int) downloadTask.getId(), mNotification); } } } }