public void dismissChatNotification(long providerId, String username) { NotificationInfo info; boolean removed; synchronized (mNotificationInfos) { info = mNotificationInfos.get(providerId); if (info == null) { return; } removed = info.removeItem(username); } if (removed) { if (info.getMessage() == null) { if (DBG) log("dismissChatNotification: removed notification for " + providerId); mNotificationManager.cancel(info.computeNotificationId()); } else { if (DBG) { log( "cancelNotify: new notification" + " mTitle=" + info.getTitle() + " mMessage=" + info.getMessage() + " mIntent=" + info.getIntent()); } mNotificationManager.notify( info.computeNotificationId(), info.createNotification("", true)); } } }
private void notify( String sender, String title, String tickerText, String message, long providerId, long accountId, Intent intent, boolean lightWeightNotify) { NotificationInfo info; synchronized (mNotificationInfos) { info = mNotificationInfos.get(providerId); if (info == null) { info = new NotificationInfo(providerId, accountId); mNotificationInfos.put(providerId, info); } info.addItem(sender, title, message, intent); } mNotificationManager.notify( info.computeNotificationId(), info.createNotification(tickerText, lightWeightNotify)); }