Question

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);
}

I only got Notification dissmised, but this don't tell me which notification was dismissed.

Was it helpful?

Solution

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

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top