辅助服务通知删除

辅助服务通知删除

本文介绍了辅助服务通知删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

反正是有知道的通知已被删除?当我把这个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.

这篇关于辅助服务通知删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 23:36