Uygulamamda birden çok bildirim oluşturmaya çalışıyorum. Her bildirimi benzersiz bir şekilde tanımlamak için onlara benzersiz bir kimlik verdim. Aşağıdaki benim kodudur:Android: Birden çok bildirimi yönetme
private void updateNotification(int notificationId, int clockStatusID, CharSequence text) {
//notificationManager.cancel(notificationId);
// throws up an ongoing notification that the timer is running
Log.i("TIMERCOUNT", "Notification id: " + notificationId);
Notification not = new Notification(clockStatusID, // the
// icon
// for
// the
// status
// bar
text, // the text to display in the ticker
System.currentTimeMillis() // the timestamp for the
// notification to appear
);
Intent intent = new Intent();
intent.putExtra("notificationID", notificationId);
intent.setAction("actionstring" + System.currentTimeMillis());
intent.setClassName("com.chander.time.android.activities",
"com.chander.time.android.activities.Tabs");
not.setLatestEventInfo(self,
getText(R.string.timer_notification_title),
getText(R.string.timer_on_notification_text), PendingIntent
.getActivity(this, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT));
not.flags += Notification.FLAG_ONGOING_EVENT;
not.flags += Notification.FLAG_NO_CLEAR;
notificationManager.notify(notificationId, not);
}
Sorun: Bir bildirim seçildiğinde, Sekmeler aktivite niyet geçirerek denir. Sekmelerde seçilen bildirimin benzersiz bildirimine erişmek istiyorum. Ben niyetinde notificationId kaydetmek için intent.putExtra() çalıştı. Ancak, birden fazla bildirim için notificationId'nin üzerine yazarak en yenisini döndürür. Bunun neden olduğunu anlayamıyorum ve bu bildirimin üzerine yazılmasını nasıl engelleyebilirim.
sayesinde Chander