public static final int NOTIFY_FAILED = 1;
private final Notification displayErrorNotification = new Notification(R.drawable.notification, "Communication Error", System.currentTimeMillis());
private void displayNotificationError(String message) {
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(), 0);
displayErrorNotification.number++;
displayErrorNotification.setLatestEventInfo(getApplicationContext(), "Failed x ("+displayErrorNotification.number+")", message, contentIntent);
notificationManager.notify(NOTIFY_FAILED, displayErrorNotification);
}
In this example I have used 1 for failed notifications but what if other programs also use the number 1 for their notifications.
What would happen when I do this:
notificationManager.cancel(NOTIFY_FAILED);