假设我的应用程序中有 2 个 Activity,名为 Act1 和 Act 2。现在,Act1 在关闭时发送状态通知,这将调用 Act2。使用 Act2,我可以清除该通知。现在假设用户没有点击通知并再次调用 Act1,通知不会被清除。我希望那发生。我怎么能那样做?
谢谢, 罗希特
最佳答案
使用 android.app.NotificationManager
您可以通过通知 id 清除通知。
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.cancel(notificationId);
关于android - 清除我的 Android 应用程序中任何 Activity 的通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11332973/