0

hello every one i am trying to use AccessibilityService.but it not work.can somebody help me to point my mistake? thanks.

MyAccessibilityService.java

 public class MyAccessbilityService extends AccessibilityService {

 @Override
    public void onAccessibilityEvent(AccessibilityEvent event) {
    // TODO Auto-generated method stub
      switch(event.getEventType()){
        case AccessibilityEvent.TYPE_VIEW_CLICKED:
          Toast.makeText(getApplicationContext(),"Click", Toast.LENGTH_SHORT).show();
          break;

        case AccessibilityEvent.TYPE_VIEW_LONG_CLICKED:
          Toast.makeText(getApplicationContext(),"Long click", Toast.LENGTH_SHORT).show();
          break;

        case AccessibilityEvent.TYPE_VIEW_FOCUSED:
           Toast.makeText(getApplicationContext(),"Focuse change", Toast.LENGTH_SHORT).show();
           break;

        case AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED:
           Toast.makeText(getApplicationContext(),"Text change", Toast.LENGTH_SHORT).show();
           break;
         }
       }

         @Override
         public void onInterrupt() {
          // TODO Auto-generated method stub
         }

         @Override
         protected void onServiceConnected() {
          // TODO Auto-generated method stub
          super.onServiceConnected();
          AccessibilityServiceInfo info = new AccessibilityServiceInfo();
          info.feedbackType = AccessibilityServiceInfo.DEFAULT;
          setServiceInfo(info);
         }
        }

the mainfest.xml like this

1 Answer 1

1

The AccessibilityServiceInfo.DEFAULT should be applied to info.flags. And the info.feedbackType should be FEEDBACK_xxxxx.

If you are interested in any feedback types, you should specify FEEDBACK_GENERIC.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.