I'm trying to make my app detect whenever a notification is displayed. I've enabled it in the settings app andonServiceConnecteddoes get called, however when I create a notification or receive an e-mail through the gmail app nothing happens,onAccessibilityEventdoes not get called.
Accessibility services in Android 4.0 and above can behave strangely if there is no accessibility-service meta-data tag defined in the manifest. Try defining the meta-data as in the examples below. You should continue to use setServiceInfo() to maintain backward compatibility with pre-4.0 devices.
Also, I would recommend specifying a feedback type that is specific to your service, rather than using "all".
Now you are defining theserviceInfoin XML and code. You may leave out the code part of AccessibilityServiceInfo because the xml is defined in the manifest. –
Daniel MartinusSep 24 '12 at 5:57
1
On the contrary, you must define it in both places for compatibility with pre-ICS devices. –
alanvSep 24 '12 at 8:01
up vote
1
down vote
The app using AccessibilityService needed to have a permission from settings>Accessibility in order to access the system events. Allow permission from settings . This may work