检测是否通知已被删除 [英] Detect if notification has been deleted

查看:285
本文介绍了检测是否通知已被删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题。我想,当一个通知已经从通知栏删除检测。

I have the following problem. I want to detect when a notification has been removed from the notification bar.

我可以扫描通知与AccessbilityService和铸造其ParcelableData将通知

I can scan notifications with an AccessbilityService and casting its ParcelableData to a notification

Notification notif = (Notification) event.getParcelableData();

我的一个想法是,如果利用该通知的的PendingIntent已被点击,但我无法找到如何检测什么。

One thought of mine was, utilizing if the PendingIntent of the notification has been clicked, but I can't find anything on how to detect that.

任何想法?我是那种绝望...尝试它的小时了。

Any ideas? I am kind of desperate... trying it for hours now.

推荐答案

一个非常类似的问题已经在这里回答了这样:

A very similar question has already been answered here on SO:

检测一个新的Andr​​oid通知

在总之,这是可能的一个新的通知出现时检测,但仅此而已。当通知被解雇,你无法察觉。

In short, it's possible to detect when a new notification appears, but that's about it. You can't detect when notifications have been dismissed.

这篇关于检测是否通知已被删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆