如何管理应用程序MainActivity上要取消的通知?
我的应用程序中有很多通知。通过每个通知,我都会调用 myProject 的主要活动。
现在我的应用程序中有多个通知,例如 aNotification、BNotification。 。 。
我知道如何取消该通知。
即:
NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(NotificationConstants.NOTIFICATION_ID_EVERY_MONTH);
但是如果有多个通知那么如何处理它?
谢谢。
I have Many Notification in My Application. By each Notification i am calling myProject's Main Activity.
Now there are Multiple Notification in My Application as like aNotification, BNotification. . .
I know how to cancel that notification.
i.e:
NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(NotificationConstants.NOTIFICATION_ID_EVERY_MONTH);
But if there are multiple Notification then how to handle it ??
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
管理多个通知的唯一方法是在通知它们时存储它们的 id
,即,
现在每次调用此函数时都需要存储“int id”,因为它在应用程序中是唯一的。然后您可以随时使用它来取消它。确保保持其唯一性,以便您可以正确管理每个通知......
Only way to manage multiple Notifications is to store their ids while notifying them
i.e,
Now you need to store the "int id" everytime you call this function as its unique within your app. Then later you can use it to cancel it whenever you want. Make sure to keep it unique so that you can manage every notificaion properly ....