Is it possible to check if a notification is visible or canceled?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I would like to update notification data, but the only way I found is to launch a new one with the same Id. The problem is that I don't want to raise a new one if the original has beed canceled. Is there a way to tell if a notification is visible or canceled? Or a way to update a notification only if it exists? 回答1: This is how I solved it: private boolean isNotificationVisible() { Intent notificationIntent = new Intent(context, MainActivity.class); PendingIntent test = PendingIntent.getActivity(context, MY_ID, notificationIntent,