问题描述
反正是有知道的通知已被删除?当我把这个code:
Is there anyway to know what notification have been removed? When I call this code:
@Override
public void onServiceConnected() {
AccessibilityServiceInfo info = new AccessibilityServiceInfo();
info.eventTypes = AccessibilityEvent.TYPES_ALL_MASK;
info.notificationTimeout = 1;
info.feedbackType = AccessibilityEvent.TYPES_ALL_MASK;
setServiceInfo(info);
}
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
String s = event.getText()+"";
Log.d(TAG, s);
}
我只拿到了通知dissmised
,但不要告诉我哪个通知被驳回。
I only got Notification dissmised
, but this don't tell me which notification was dismissed.
推荐答案
的您应该使用 NotificationListenerService 用于此目的(为了赶上应用的通知 NotificationListenerService 就像是辅助服务,另一种选择)。的
You should use NotificationListenerService for this purpose (To catch Notification of application NotificationListenerService is another option like Accessibility Service).
其中, onNotificationRemoved 给 StatusBarNotification 成参数。通过阅读这个参数就可以得到有关通知的所有信息。
Where onNotificationRemoved gives StatusBarNotification into parameter. By reading this param you can get all information about notification.
您可以阅读了解更多详情。
You can read NotificationListenerService-Example for more details.
这篇关于辅助服务通知删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!