0

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.

Rotary Heart
  • 1,899
  • 3
  • 29
  • 44

1 Answers1

1

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.

Pankaj Kumar
  • 81,967
  • 29
  • 167
  • 186
  • I have no idea about this if there any option available or not. If you will get update this answer :). – Pankaj Kumar Aug 08 '13 at 09:58
  • http://gmariotti.blogspot.co.uk/2013/02/how-to-write-dashclock-extension_23.html?m=1 read this if can help? – Pankaj Kumar Aug 08 '13 at 09:58
  • After reading that link I implemented something very similar. – Rotary Heart Aug 17 '13 at 19:06
  • Could you please provide your answer here? I can't seem to find anything on that blog that will solve this, it only uses the screen on/off which will not work for many apps. How do you even get "Notification dissmised" event when the notification has been removed in the first place? Maybe post the answer? – user961186 Mar 27 '14 at 16:57