Android Notification消失而不是添加通知管理器?

时间:2014-12-10 23:02:14

标签: android notifications

您好我有系统通知,这项工作正常,但如果两个或多个通知发送第一个通知消失到通知中心,我该怎么办才能显示两个通知?我有通知的例子:

Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
                            Notification n  = new Notification.Builder(context)
                                    .setContentTitle("Redar App")
                                    .setContentText("Welcome to:  "+ restaurant_name)
                                    .setSmallIcon(R.drawable.ic_launcher)
                                    .setContentIntent(pIntent)
                                    .setVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 })
                                    .setAutoCancel(true)
                                    .setSound(alarmSound).build();
                            n.tickerText = "Redar Beacons ";
                            n.when = System.currentTimeMillis();
                            NotificationManager notificationManager =
                                    (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

                            notificationManager.notify(0, n);

1 个答案:

答案 0 :(得分:1)

您需要在

中触发通知时更新通知ID
notificationManager.notify(ID, notification);