Question

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

}

Was it helpful?

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.

OTHER TIPS

Yes. It's possible in all versions of Android at least from 2.0 where I started coding my app the does exactly what you are talking about. See here https://gist.github.com/1909616

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