Search code examples
androidnotificationsaccessibilityandroid-4.2-jelly-bean

Does AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED work on Jelly Bean?


I have a service running to collect accessibility events. In Jelly Bean, it isn't capturing any change on TYPE_NOTIFICATION_STATE_CHANGED events. I follow the tutorials but nothing...

Here is my code:

@Override
protected void onServiceConnected() {
    super.onServiceConnected();

    AccessibilityServiceInfo localAccessibilityServiceInfo = new AccessibilityServiceInfo();
    localAccessibilityServiceInfo.eventTypes = AccessibilityEvent.TYPES_ALL_MASK;          
    localAccessibilityServiceInfo.notificationTimeout = 80L;
    localAccessibilityServiceInfo.feedbackType = AccessibilityServiceInfo.DEFAULT;
    setServiceInfo(localAccessibilityServiceInfo);
}

@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    if(event.getEventType() ==  AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED)
        doSomething();

}


Solution

  • See my post here AccessibilityService is started but does not receive AccessibilityEvents on JellyBean on the way I managed to get this working

    For some reason declarative xml to register the events seems to work, but registering them using code (like versions prior ICS had to) just doesn't seem to pick up on the events.