How to get the notifications in android using Accessibility Service above 4.0?
Why onAccessibilityEvent(AccessibilityEvent event)
not calling When Notification fired above 4.0
Please give Proper Suggestion
Thanks in advance
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
final int eventType = event.getEventType();
System.out.println("MyServ.onAccessibilityEvent()");
switch (eventType) {
case AccessibilityEvent.TYPE_VIEW_FOCUSED:
Toast.makeText(getApplicationContext(), "Notification fired",
Toast.LENGTH_LONG).show();
break;
case AccessibilityEvent.TYPE_ANNOUNCEMENT:
Toast.makeText(getApplicationContext(), "Type is Announcement",
Toast.LENGTH_LONG).show();
break;
default:
break;
}
}
In onServiceConnected()
@Override
protected void onServiceConnected() {
super.onServiceConnected();
AccessibilityServiceInfo info = new AccessibilityServiceInfo();
info.eventTypes = AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED;
info.feedbackType = AccessibilityServiceInfo.FEEDBACK_SPOKEN;
setServiceInfo(info);
}