Code example for NotificationManager: Notifying from the background

Methods: cancelnotify

0
 
		final Handler downloadFinishHandler = new Handler() {
			public void handleMessage(Message message) {
				myDownloadingURLs.remove(urlString);
				final NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
				notificationManager.cancel(notificationId);
				myOngoingNotifications.remove(Integer.valueOf(notificationId));
				notificationManager.notify(
					notificationId,
					createDownloadFinishNotification(file, title, message.what != 0)
				); 
				sendDownloaderCallback(); 
				doStop(); 
			} 
		}; 
 
		final ZLNetworkRequest request = new ZLNetworkRequest(urlString) {
			public void handleStream(InputStream inputStream, int length) throws IOException, ZLNetworkException {
				final int updateIntervalMillis = 1000; // FIXME: remove hardcoded time constant
 
Connect your IDE to all the code out there  Get Codota for Java