辅助服务通知删除 [英] Accessibility service notification removed

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

问题描述

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

推荐答案

您应该使用<一个href=\"http://developer.android.com/reference/android/service/notification/NotificationListenerService.html\"相对=nofollow> NotificationListenerService 用于此目的(为了赶上应用的通知<一个href=\"http://developer.android.com/reference/android/service/notification/NotificationListenerService.html\"相对=nofollow> NotificationListenerService 就像是辅助服务,另一种选择)。

You should use NotificationListenerService for this purpose (To catch Notification of application NotificationListenerService is another option like Accessibility Service).

其中,<一个href=\"http://developer.android.com/reference/android/service/notification/NotificationListenerService.html#onNotificationRemoved%28android.service.notification.StatusBarNotification%29\"相对=nofollow> onNotificationRemoved 给<一个href=\"http://developer.android.com/reference/android/service/notification/StatusBarNotification.html\"相对=nofollow> StatusBarNotification 成参数。通过阅读这个参数就可以得到有关通知的所有信息。

Where onNotificationRemoved gives StatusBarNotification into parameter. By reading this param you can get all information about notification.

您可以阅读 NotificationListenerService-举例了解更多详情。

You can read NotificationListenerService-Example for more details.

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

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